test
This commit is contained in:
parent
efd21a7297
commit
441676be27
97 changed files with 10764 additions and 223 deletions
34
frontend/src/features/settings/index.ts
Normal file
34
frontend/src/features/settings/index.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { apiRequest } from "@/lib/api/client";
|
||||
|
||||
export interface UserSettings {
|
||||
auto_run_enabled: boolean;
|
||||
run_interval_minutes: number;
|
||||
request_delay_seconds: number;
|
||||
}
|
||||
|
||||
export interface ChangePasswordPayload {
|
||||
current_password: string;
|
||||
new_password: string;
|
||||
confirm_password: string;
|
||||
}
|
||||
|
||||
export async function fetchSettings(): Promise<UserSettings> {
|
||||
const response = await apiRequest<UserSettings>("/settings", { method: "GET" });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export async function updateSettings(payload: UserSettings): Promise<UserSettings> {
|
||||
const response = await apiRequest<UserSettings>("/settings", {
|
||||
method: "PUT",
|
||||
body: payload,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export async function changePassword(payload: ChangePasswordPayload): Promise<{ message: string }> {
|
||||
const response = await apiRequest<{ message: string }>("/auth/change-password", {
|
||||
method: "POST",
|
||||
body: payload,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue