Prevent flashing and intermittent errors when navigating to admin screens as a non admin
This commit is contained in:
parent
0838a45efc
commit
1f1431344c
|
@ -0,0 +1,18 @@
|
|||
<script>
|
||||
import { Page } from "@budibase/bbui"
|
||||
import { auth } from "stores/portal"
|
||||
import { redirect } from "@roxi/routify"
|
||||
|
||||
// Only admins allowed here
|
||||
$: {
|
||||
if (!$auth.isAdmin) {
|
||||
$redirect("../")
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if $auth.isAdmin}
|
||||
<Page>
|
||||
<slot />
|
||||
</Page>
|
||||
{/if}
|
|
@ -1,14 +0,0 @@
|
|||
<script>
|
||||
import { redirect } from "@roxi/routify"
|
||||
import { Page } from "@budibase/bbui"
|
||||
import { auth } from "../../../../../stores/portal"
|
||||
|
||||
// only admins allowed here
|
||||
if (!$auth.isAdmin) {
|
||||
$redirect("../../../portal")
|
||||
}
|
||||
</script>
|
||||
|
||||
<Page>
|
||||
<slot />
|
||||
</Page>
|
|
@ -1,11 +1,5 @@
|
|||
<script>
|
||||
import { redirect } from "@roxi/routify"
|
||||
import { auth, email } from "stores/portal"
|
||||
|
||||
// only admins allowed here
|
||||
if (!$auth.isAdmin) {
|
||||
$redirect("../../../portal")
|
||||
}
|
||||
import { email } from "stores/portal"
|
||||
|
||||
email.templates.fetch()
|
||||
</script>
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
<script>
|
||||
import { Page } from "@budibase/bbui"
|
||||
import { auth } from "../../../../../stores/portal"
|
||||
import { redirect } from "@roxi/routify"
|
||||
|
||||
// only admins allowed here
|
||||
if (!$auth.isAdmin) {
|
||||
$redirect("../../../portal")
|
||||
}
|
||||
</script>
|
||||
|
||||
<Page>
|
||||
<slot />
|
||||
</Page>
|
|
@ -17,10 +17,12 @@
|
|||
import { writable } from "svelte/store"
|
||||
import { redirect } from "@roxi/routify"
|
||||
|
||||
// only admins allowed here
|
||||
// Only admins allowed here
|
||||
$: {
|
||||
if (!$auth.isAdmin) {
|
||||
$redirect("../../portal")
|
||||
}
|
||||
}
|
||||
|
||||
const values = writable({
|
||||
analytics: !analytics.disabled(),
|
||||
|
@ -70,7 +72,8 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<Layout>
|
||||
{#if $auth.isAdmin}
|
||||
<Layout>
|
||||
<Layout gap="XS" noPadding>
|
||||
<Heading size="M">Organisation</Heading>
|
||||
<Body>
|
||||
|
@ -131,7 +134,8 @@
|
|||
<div>
|
||||
<Button disabled={loading} on:click={saveConfig} cta>Save</Button>
|
||||
</div>
|
||||
</Layout>
|
||||
</Layout>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.fields {
|
||||
|
|
Loading…
Reference in New Issue