Move account portal redirect to top of auth level

This commit is contained in:
Rory Powell 2021-09-14 15:57:34 +01:00
parent 8e9c1aa204
commit b2471594cf
3 changed files with 7 additions and 8 deletions

View File

@ -1,5 +1,5 @@
<script>
import { auth } from "stores/portal"
import { auth, admin } from "stores/portal"
import { onMount } from "svelte"
import { redirect } from "@roxi/routify"
@ -10,6 +10,11 @@
if ($auth.user && !$auth.user.forceResetPassword) {
$redirect("../")
}
// redirect to account portal for authentication in the cloud
if ($admin.cloud && $admin.accountPortalUrl) {
window.location.href = $admin.accountPortalUrl
}
})
</script>

View File

@ -51,12 +51,6 @@
onMount(async () => {
await organisation.init()
// redirect to account portal for login in the cloud
if ($admin.cloud && $admin.accountPortalUrl) {
window.location.href = $admin.accountPortalUrl
}
loaded = true
})
</script>

View File

@ -60,7 +60,7 @@
}
// add link to account portal if the user has access
if ($auth.user.account) {
if ($auth?.user?.account) {
menu = menu.concat([
{
title: "Account",