store: catch failure to load from API

This commit is contained in:
Jörn-Michael Miehe 2024-08-26 19:13:08 +00:00
parent af5abc7c8f
commit d0d81510cc

View file

@ -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 {