feat: units system — mm/cm/m switchable, configurable grid, real measurements, formatted display
This commit is contained in:
@@ -608,6 +608,33 @@ export async function deleteGlobalBlock(token: string, id: string): Promise<void
|
||||
|
||||
export { API_BASE };
|
||||
|
||||
// ─── Settings (Key/Value) ────────────────────────────────
|
||||
export interface Setting {
|
||||
key: string;
|
||||
value: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export async function getSetting(token: string, key: string): Promise<Setting | null> {
|
||||
const res = await fetch(`${API_BASE}/api/settings/${encodeURIComponent(key)}`, {
|
||||
method: 'GET',
|
||||
headers: authHeaders(token),
|
||||
});
|
||||
if (res.status === 404) return null;
|
||||
if (!res.ok) throw new Error(`Failed to fetch setting: ${key}`);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function setSetting(token: string, key: string, value: string): Promise<Setting> {
|
||||
const res = await fetch(`${API_BASE}/api/settings/${encodeURIComponent(key)}`, {
|
||||
method: 'PUT',
|
||||
headers: authHeaders(token),
|
||||
body: JSON.stringify({ value }),
|
||||
});
|
||||
if (!res.ok) throw new Error(`Failed to save setting: ${key}`);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
// ─── AI Copilot ─────────────────────────────────────────
|
||||
export interface AIChatMessage {
|
||||
role: string;
|
||||
|
||||
Reference in New Issue
Block a user