Skip to content

Commit

Permalink
refactor: remove obsolete "Loading" screen from landing page (#94)
Browse files Browse the repository at this point in the history
Remove obsolete "Loading" screen from landing page
  • Loading branch information
OLILHR authored Feb 5, 2025
1 parent 40a0ce4 commit b635108
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import auth from "$src/auth/authService";
import { isAuthenticated } from "$src/store";
let isLoading = true;
const exposedEndpoints = [`${base}/`, `${base}/version/`];
onMount(async () => {
Expand All @@ -26,36 +24,29 @@
}
await auth.checkAuth();
isLoading = false;
isAuthenticated.subscribe((value: boolean) => {
const isExposedEndpoint = exposedEndpoints.includes($page.url.pathname);
if (!value && !isLoading && !isExposedEndpoint) {
if (!value && !isExposedEndpoint) {
goto(`${base}/`);
}
});
});
$: {
const isExposedEndpoint = exposedEndpoints.includes($page.url.pathname);
if (!$isAuthenticated && !isLoading && !isExposedEndpoint) {
if (!$isAuthenticated && !isExposedEndpoint) {
goto(`${base}/`);
}
}
</script>

{#if isLoading}
<div class="flex items-center justify-center h-screen">
<p>Loading...</p>
</div>
{:else}
<div class="flex flex-col h-screen overflow-hidden">
<main class="flex-grow flex flex-col min-h-0">
<slot />
</main>
<Footer />
</div>
{/if}
<div class="flex flex-col h-screen overflow-hidden">
<main class="flex-grow flex flex-col min-h-0">
<slot />
</main>
<Footer />
</div>

<style>
:global(body) {
Expand Down

0 comments on commit b635108

Please sign in to comment.