mirror of
https://github.com/revanced/revanced-website.git
synced 2025-05-25 11:02:17 +02:00
refactor: better banner logic
This commit is contained in:
parent
ff58050f13
commit
485ac26c30
@ -4,13 +4,23 @@
|
|||||||
import api from '$api';
|
import api from '$api';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#await api.general.ping() then apiUp}
|
<!-- make the banner a snippet to remove duplicate code -->
|
||||||
{#if !apiUp}
|
{#snippet apiDownBanner()}
|
||||||
<Banner level="caution" permanent>
|
<Banner level="caution" permanent>
|
||||||
The API is currently unresponsive and some services may not work correctly.
|
The API is currently unresponsive and some services may not work correctly.
|
||||||
{#await api.general.getAbout() then data}
|
{#await api.general.getAbout() then data}
|
||||||
Check the <Button type="text" href={data.status}>status page</Button> for updates.
|
Check the <Button type="text" href={data.status}>status page</Button> for updates.
|
||||||
{/await}
|
{/await}
|
||||||
</Banner>
|
</Banner>
|
||||||
{/if}
|
{/snippet}
|
||||||
{/await}
|
|
||||||
|
<div class="nav-container">
|
||||||
|
<!-- whether the api doesn't return 204 or the request itself fails, show banner -->
|
||||||
|
{#await api.general.ping() then apiUp}
|
||||||
|
{#if !apiUp}
|
||||||
|
{@render apiDownBanner()}
|
||||||
|
{/if}
|
||||||
|
{:catch _}
|
||||||
|
{@render apiDownBanner()}
|
||||||
|
{/await}
|
||||||
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user