store: catch failure to load from API
This commit is contained in:
parent
af5abc7c8f
commit
d0d81510cc
1 changed files with 23 additions and 19 deletions
|
@ -67,6 +67,7 @@ export const advent22Store = defineStore({
|
||||||
document.getElementsByTagName("head")[0].appendChild(link);
|
document.getElementsByTagName("head")[0].appendChild(link);
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
||||||
|
try {
|
||||||
const [is_admin, site_config, background_image, user_doors, next_door] =
|
const [is_admin, site_config, background_image, user_doors, next_door] =
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.update_is_admin(),
|
this.update_is_admin(),
|
||||||
|
@ -91,6 +92,9 @@ export const advent22Store = defineStore({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (next_door !== null) this.next_door_target = Date.now() + next_door;
|
if (next_door !== null) this.next_door_target = Date.now() + next_door;
|
||||||
|
} catch {
|
||||||
|
this.background_image = "error";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
when_initialized(callback: () => void): void {
|
when_initialized(callback: () => void): void {
|
||||||
|
|
Loading…
Reference in a new issue