diff options
| author | soryu <soryu@soryu.co> | 2026-04-29 01:10:11 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-29 01:10:11 +0100 |
| commit | 4b1d608b839769052634b4facc345b891d468926 (patch) | |
| tree | 1d5ff45b5b34b2e3e378a4cf69fd62ff39cf12de /makima/frontend/src/lib/api.ts | |
| parent | 5bde7c2d7e099fd9c8b2615602ab1d096bd9b6be (diff) | |
| download | soryu-4b1d608b839769052634b4facc345b891d468926.tar.gz soryu-4b1d608b839769052634b4facc345b891d468926.zip | |
feat: document-mode directive UI proof of concept (Lexical) (#101)
* WIP: heartbeat checkpoint
* feat: soryu-co/soryu - makima: Backend: feature flag + goal-edit interrupt messaging
* WIP: heartbeat checkpoint
* WIP: heartbeat checkpoint
* feat: soryu-co/soryu - makima: Frontend: Lexical document editor with step blocks, context menu, countdown
Diffstat (limited to 'makima/frontend/src/lib/api.ts')
| -rw-r--r-- | makima/frontend/src/lib/api.ts | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/makima/frontend/src/lib/api.ts b/makima/frontend/src/lib/api.ts index d597b44..8896f2c 100644 --- a/makima/frontend/src/lib/api.ts +++ b/makima/frontend/src/lib/api.ts @@ -1696,6 +1696,52 @@ export async function deleteAccount( } // ============================================================================= +// User Settings (per-user feature flags) +// ============================================================================= + +/** Per-user settings / feature flags. */ +export interface UserSettings { + /** Whether the new "document mode" UI is enabled for this user. */ + documentModeEnabled: boolean; +} + +/** Request body for updating user settings. */ +export interface UpdateUserSettingsRequest { + documentModeEnabled: boolean; +} + +/** + * Get the authenticated user's settings (feature flags). + */ +export async function getUserSettings(): Promise<UserSettings> { + const res = await authFetch(`${API_BASE}/api/v1/users/me/settings`); + if (!res.ok) { + const errorData = await res.json().catch(() => null); + const errorMessage = errorData?.message || res.statusText; + throw new Error(errorMessage); + } + return res.json(); +} + +/** + * Replace the authenticated user's settings (feature flags). + */ +export async function updateUserSettings( + req: UpdateUserSettingsRequest +): Promise<UserSettings> { + const res = await authFetch(`${API_BASE}/api/v1/users/me/settings`, { + method: "PUT", + body: JSON.stringify(req), + }); + if (!res.ok) { + const errorData = await res.json().catch(() => null); + const errorMessage = errorData?.message || res.statusText; + throw new Error(errorMessage); + } + return res.json(); +} + +// ============================================================================= // Contract Types for Workflow Management // ============================================================================= |
