summaryrefslogtreecommitdiff
path: root/makima/frontend/src/lib/api.ts
diff options
context:
space:
mode:
Diffstat (limited to 'makima/frontend/src/lib/api.ts')
-rw-r--r--makima/frontend/src/lib/api.ts46
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
// =============================================================================