/** * Setup wizard API functions. * * Wraps calls to GET /api/setup and POST /api/setup. */ import { api } from "./client"; import { ENDPOINTS } from "./endpoints"; import type { SetupRequest, SetupResponse, SetupStatusResponse, SetupTimezoneResponse, } from "../types/setup"; /** * Check whether the initial setup has been completed. * * @returns Setup status response with a `completed` boolean. */ export async function getSetupStatus(): Promise { return api.get(ENDPOINTS.setup); } /** * Submit the initial setup configuration. * * @param data - Setup request payload. * @returns Success message from the API. */ export async function submitSetup(data: SetupRequest): Promise { return api.post(ENDPOINTS.setup, data); } /** * Fetch the IANA timezone configured during setup. * * Used by the frontend to convert UTC timestamps to the local timezone * chosen by the administrator. * * @returns The configured timezone identifier (e.g. `"Europe/Berlin"`). */ export async function fetchTimezone(): Promise { return api.get(ENDPOINTS.setupTimezone); }