web: fix locale erroring with no pre-hydrated locale setting
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
d497db3010
commit
b896ca7ef6
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ export function autoDetectLanguage() {
|
|||
const detected =
|
||||
detect(
|
||||
() => {
|
||||
return globalAK().locale;
|
||||
return globalAK()?.locale;
|
||||
},
|
||||
fromUrl("locale"),
|
||||
fromNavigator(),
|
||||
|
|
Reference in a new issue