diff --git a/web/src/api/Global.ts b/web/src/api/Global.ts index 0a5135267..bbec287a5 100644 --- a/web/src/api/Global.ts +++ b/web/src/api/Global.ts @@ -6,9 +6,9 @@ export interface GlobalAuthentik { } export interface AuthentikWindow { - authentik: GlobalAuthentik; + authentik?: GlobalAuthentik; } -export function globalAK(): GlobalAuthentik { +export function globalAK(): GlobalAuthentik | undefined { return (window as unknown as AuthentikWindow).authentik; } diff --git a/web/src/interfaces/locale.ts b/web/src/interfaces/locale.ts index 500abd056..f9cb83ea3 100644 --- a/web/src/interfaces/locale.ts +++ b/web/src/interfaces/locale.ts @@ -125,7 +125,7 @@ export function autoDetectLanguage() { const detected = detect( () => { - return globalAK().locale; + return globalAK()?.locale; }, fromUrl("locale"), fromNavigator(),