Phase D
Some checks failed
CI / Node — lint, typecheck, test, build (push) Failing after 9s
CI / Go — node-agent tests (push) Failing after 8s
CI / Go — edge-gateway build (push) Successful in 17s

This commit is contained in:
smueller
2026-06-26 14:03:57 +02:00
parent ed8334328e
commit 333ad1cc7d
31 changed files with 964 additions and 15 deletions

View File

@@ -48,8 +48,23 @@ export interface CurrentUser {
username: string;
displayName?: string | null;
emailVerifiedAt?: string | null;
emailVerified?: boolean;
roles?: string[];
twoFactorEnabled?: boolean;
impersonation?: {
isImpersonation: boolean;
label?: string;
impersonatorLabel?: string;
};
}
export interface MeResponse {
user: CurrentUser;
impersonation?: {
isImpersonation: boolean;
impersonatorLabel?: string;
label?: string;
};
}
export interface TwoFactorSetupResponse {
@@ -149,8 +164,30 @@ export async function submitLogout(): Promise<void> {
});
}
export async function getCurrentUser(): Promise<CurrentUser> {
return apiFetch<CurrentUser>("/me");
export async function getCurrentUser(): Promise<CurrentUser | null> {
try {
const response = await apiFetch<MeResponse>("/me");
return {
...response.user,
impersonation: response.impersonation
? {
isImpersonation: response.impersonation.isImpersonation,
label:
response.impersonation.label ??
response.impersonation.impersonatorLabel,
}
: undefined,
};
} catch {
return null;
}
}
export async function consumeSsoTicket(ticket: string): Promise<{ redirectPath: string }> {
return apiFetch<{ redirectPath: string }>("/auth/sso/consume", {
method: "POST",
body: JSON.stringify({ ticket }),
});
}
export async function verifyEmail(token: string): Promise<void> {