From 2e335019cde679bcf749bc6cacdfcd137e9f7eb3 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 6 May 2021 14:52:20 +0100 Subject: [PATCH] Tidy up auth logic in routes --- packages/builder/src/components/login/LoginForm.svelte | 2 +- packages/builder/src/pages/_layout.svelte | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/components/login/LoginForm.svelte b/packages/builder/src/components/login/LoginForm.svelte index 617e6c8463..f6f4f314c8 100644 --- a/packages/builder/src/components/login/LoginForm.svelte +++ b/packages/builder/src/components/login/LoginForm.svelte @@ -18,7 +18,7 @@ username, password, }) - notifications.success("Logged in successfully.") + notifications.success("Logged in successfully") $goto("../portal") } catch (err) { console.error(err) diff --git a/packages/builder/src/pages/_layout.svelte b/packages/builder/src/pages/_layout.svelte index 587092c718..fdc9bc2251 100644 --- a/packages/builder/src/pages/_layout.svelte +++ b/packages/builder/src/pages/_layout.svelte @@ -8,12 +8,11 @@ onMount(async () => { await admin.init() + await auth.checkAuth() if (!$admin?.checklist?.adminUser) { $goto("./admin") - } else { - await auth.checkAuth() - checked = true } + checked = true }) $: { @@ -23,6 +22,6 @@ } -{#if $admin.checklist} +{#if checked} {/if}