web: fix locale erroring with no pre-hydrated locale setting

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-07-06 09:53:46 +02:00
parent d497db3010
commit b896ca7ef6
2 changed files with 3 additions and 3 deletions

View File

@ -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;
}

View File

@ -125,7 +125,7 @@ export function autoDetectLanguage() {
const detected =
detect(
() => {
return globalAK().locale;
return globalAK()?.locale;
},
fromUrl("locale"),
fromNavigator(),