Tidy up auth logic in routes
This commit is contained in:
parent
ba65dfd718
commit
e29df9f45c
|
@ -18,7 +18,7 @@
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
})
|
})
|
||||||
notifications.success("Logged in successfully.")
|
notifications.success("Logged in successfully")
|
||||||
$goto("../portal")
|
$goto("../portal")
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
|
|
@ -8,12 +8,11 @@
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await admin.init()
|
await admin.init()
|
||||||
|
await auth.checkAuth()
|
||||||
if (!$admin?.checklist?.adminUser) {
|
if (!$admin?.checklist?.adminUser) {
|
||||||
$goto("./admin")
|
$goto("./admin")
|
||||||
} else {
|
|
||||||
await auth.checkAuth()
|
|
||||||
checked = true
|
|
||||||
}
|
}
|
||||||
|
checked = true
|
||||||
})
|
})
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
|
@ -23,6 +22,6 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $admin.checklist}
|
{#if checked}
|
||||||
<slot />
|
<slot />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
Loading…
Reference in New Issue