Added reloading in error situations.

This commit is contained in:
2026-05-07 10:28:08 +02:00
parent 00585653c7
commit 4fc5fe5778

View File

@@ -5,10 +5,17 @@
let companies: Company[] = [];
let loading = true;
let error = false;
onMount(async () => {
try {
companies = await api.getCompanies();
} catch {
error = true;
setTimeout(() => location.reload(), 5000);
} finally {
loading = false;
}
});
</script>
@@ -22,6 +29,10 @@
<div style="text-align: center; padding: 48px;">
<p>Laden...</p>
</div>
{:else if error}
<div style="text-align: center; padding: 48px;">
<p style="color: var(--color-warning);">Verbindungsfehler Seite wird in 5 Sekunden neu geladen…</p>
</div>
{:else}
<div class="card-grid" style="padding: 24px;">
{#each companies as company}