ui: Fix loading problems when themes arrived to late

This commit is contained in:
nemunaire 2021-09-01 01:42:56 +02:00
commit 941e1c16d5
5 changed files with 40 additions and 41 deletions

View file

@ -53,14 +53,14 @@
</script>
<svelte:head>
<title>{exercice.title} - {$settings.title}</title>
<title>{exercice?exercice.title+" - ":""}{$settings.title}</title>
</svelte:head>
{#if exercice}
<ThemeNav {theme} {exercice} />
{/if}
{#if !$my || !$my.exercices[exercice.id]}
{#if !$my || !exercice || !$my.exercices[exercice.id]}
<Alert color="warning" class="mt-3" fade={false}>
<Icon name="dash-circle-fill" />
Vous n'avez pas encore accès à ce défi.

View file

@ -7,9 +7,8 @@
const thms = get_store_value(themes);
let theme = null;
for (let th in thms) {
if (thms[th].urlid === page.params.theme) {
if (thms[th] && thms[th].urlid === page.params.theme) {
theme = thms[th];
break;
}
@ -33,11 +32,11 @@
import { settings } from '../../stores/settings.js';
export let theme = null;
export let theme;
</script>
<svelte:head>
<title>{theme.name} - {$settings.title}</title>
<title>{theme?theme.name:""} - {$settings.title}</title>
</svelte:head>
{#if theme}

View file

@ -57,7 +57,7 @@
}
refresh_interval_themes = setInterval(refresh_themes, interval);
themesStore.update(await fetch('/themes.json'), cb);
await themesStore.update(await fetch('/themes.json'), cb);
}
let refresh_interval_my = null;