Added reloading in error situations.
This commit is contained in:
@@ -5,10 +5,17 @@
|
|||||||
|
|
||||||
let companies: Company[] = [];
|
let companies: Company[] = [];
|
||||||
let loading = true;
|
let loading = true;
|
||||||
|
let error = false;
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
|
try {
|
||||||
companies = await api.getCompanies();
|
companies = await api.getCompanies();
|
||||||
|
} catch {
|
||||||
|
error = true;
|
||||||
|
setTimeout(() => location.reload(), 5000);
|
||||||
|
} finally {
|
||||||
loading = false;
|
loading = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -22,6 +29,10 @@
|
|||||||
<div style="text-align: center; padding: 48px;">
|
<div style="text-align: center; padding: 48px;">
|
||||||
<p>Laden...</p>
|
<p>Laden...</p>
|
||||||
</div>
|
</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}
|
{:else}
|
||||||
<div class="card-grid" style="padding: 24px;">
|
<div class="card-grid" style="padding: 24px;">
|
||||||
{#each companies as company}
|
{#each companies as company}
|
||||||
|
|||||||
Reference in New Issue
Block a user