initial commit after split

This commit is contained in:
2026-06-24 01:43:10 +02:00
parent b1d6c0150f
commit 30c11a6dcf
173 changed files with 25380 additions and 0 deletions

37
webui/src/api/auth.ts Normal file
View File

@@ -0,0 +1,37 @@
import type { ApiSettings, AuthInfo, LoginResponse } from "../types";
import { apiFetch } from "./client";
export async function login(
settings: ApiSettings,
payload: { email: string; password: string }
): Promise<LoginResponse> {
return apiFetch<LoginResponse>({ ...settings, accessToken: "", apiKey: "" }, "/api/v1/auth/login", {
method: "POST",
body: JSON.stringify(payload)
});
}
export async function fetchMe(settings: ApiSettings): Promise<AuthInfo> {
return apiFetch<AuthInfo>(settings, "/api/v1/auth/me");
}
export async function switchTenant(settings: ApiSettings, tenantId: string): Promise<AuthInfo> {
return apiFetch<AuthInfo>(settings, "/api/v1/auth/switch-tenant", {
method: "POST",
body: JSON.stringify({ tenant_id: tenantId })
});
}
export async function logout(settings: ApiSettings): Promise<void> {
await apiFetch(settings, "/api/v1/auth/logout", { method: "POST" });
}
export async function updateProfile(
settings: ApiSettings,
payload: { display_name?: string | null; tenant_display_name?: string | null }
): Promise<AuthInfo> {
return apiFetch<AuthInfo>(settings, "/api/v1/auth/profile", {
method: "PATCH",
body: JSON.stringify(payload)
});
}