Add 'apps/mobile/' from commit '5fa30f365f21531094cd4d2045042bb4f1370ac3'
git-subtree-dir: apps/mobile git-subtree-mainline:86f8987dffgit-subtree-split:5fa30f365f
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
export type AuthCapabilities = {
|
||||
authentik: boolean;
|
||||
signupsDisabled: boolean;
|
||||
};
|
||||
|
||||
const DEFAULT_CAPABILITIES: AuthCapabilities = {
|
||||
authentik: false,
|
||||
signupsDisabled: false,
|
||||
};
|
||||
|
||||
export async function fetchAuthCapabilities(apiUrl: string): Promise<AuthCapabilities> {
|
||||
const base = apiUrl.replace(/\/$/, "");
|
||||
|
||||
try {
|
||||
const response = await fetch(`${base}/api/auth/capabilities`);
|
||||
if (!response.ok) return DEFAULT_CAPABILITIES;
|
||||
return (await response.json()) as AuthCapabilities;
|
||||
} catch {
|
||||
return DEFAULT_CAPABILITIES;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user