Added reloading in error situations.
This commit is contained in:
@@ -5,10 +5,17 @@
|
||||
|
||||
let companies: Company[] = [];
|
||||
let loading = true;
|
||||
let error = false;
|
||||
|
||||
onMount(async () => {
|
||||
companies = await api.getCompanies();
|
||||
loading = false;
|
||||
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}
|
||||
|
||||
Reference in New Issue
Block a user