mirror of
https://github.com/temetro/temetro.git
synced 2026-09-03 14:27:58 +00:00
frontend: working profile settings with sticky save + real account deletion
- ToggleRow supports controlled checked/onCheckedChange; CopyField copy works - ProfilePanel loads/saves preferences via /api/settings, name via updateUser - dirty tracking with a sticky save bar that follows the scroll - Delete account: password-confirmed dialog wired to authClient.deleteUser - clinician ID / handle now show the real session user Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { apiFetch } from "@/lib/api-client";
|
||||
|
||||
// Per-user preferences persisted by the backend (`user_settings` table) as a
|
||||
// flat key → boolean/string map. Unknown keys are preserved, so features can
|
||||
// add settings without coordinating with this file.
|
||||
export type UserPreferences = Record<string, boolean | string>;
|
||||
|
||||
export async function getSettings(): Promise<UserPreferences> {
|
||||
const res = await apiFetch<{ preferences: UserPreferences }>("/api/settings");
|
||||
return res.preferences ?? {};
|
||||
}
|
||||
|
||||
export async function saveSettings(
|
||||
preferences: UserPreferences,
|
||||
): Promise<UserPreferences> {
|
||||
const res = await apiFetch<{ preferences: UserPreferences }>(
|
||||
"/api/settings",
|
||||
{
|
||||
method: "PUT",
|
||||
body: JSON.stringify({ preferences }),
|
||||
},
|
||||
);
|
||||
return res.preferences ?? {};
|
||||
}
|
||||
Reference in New Issue
Block a user