fix: permission missing if refresh
Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
parent
dbb5ce466c
commit
3f5eb8d07d
2 changed files with 18 additions and 6 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import favicon from '$lib/assets/favicon.svg';
|
import favicon from '$lib/assets/favicon.svg';
|
||||||
let { children } = $props();
|
let { children } = $props();
|
||||||
|
|
||||||
|
// try get permissions
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
|
|
@ -10,5 +11,4 @@
|
||||||
<title>Taobin Management Tools</title>
|
<title>Taobin Management Tools</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
|
{@render children()}
|
||||||
{@render children()}
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
import ArrowRight from '@lucide/svelte/icons/arrow-right';
|
import ArrowRight from '@lucide/svelte/icons/arrow-right';
|
||||||
import { permission as currentPermissions } from '$lib/core/stores/permissions';
|
import { permission as currentPermissions } from '$lib/core/stores/permissions';
|
||||||
import { get } from 'svelte/store';
|
import { get } from 'svelte/store';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
let recipeModBtn = $state<HTMLElement | null>(null);
|
let recipeModBtn = $state<HTMLElement | null>(null);
|
||||||
let monitorModBtn = $state<HTMLElement | null>(null);
|
let monitorModBtn = $state<HTMLElement | null>(null);
|
||||||
|
|
@ -16,6 +17,8 @@
|
||||||
|
|
||||||
let animationPulseGoto: JSAnimation;
|
let animationPulseGoto: JSAnimation;
|
||||||
|
|
||||||
|
let perms = $state<string[]>([]);
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
if (gotoDashboardBtn && !animationPulseGoto) {
|
if (gotoDashboardBtn && !animationPulseGoto) {
|
||||||
animationPulseGoto = animate(gotoDashboardBtn, {
|
animationPulseGoto = animate(gotoDashboardBtn, {
|
||||||
|
|
@ -30,7 +33,16 @@
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
let perms = get(currentPermissions);
|
// let perms = get(currentPermissions);
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
return currentPermissions.subscribe((perm) => {
|
||||||
|
console.log('sub get perm', JSON.stringify(perm));
|
||||||
|
if (perm.length > 0) {
|
||||||
|
perms = perm;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex h-screen items-center justify-center">
|
<div class="flex h-screen items-center justify-center">
|
||||||
|
|
@ -101,7 +113,7 @@
|
||||||
|
|
||||||
{#if perms.filter((x) => x.startsWith('document.read') || x.startsWith('document.write') || x.startsWith('tools')).length == 0}
|
{#if perms.filter((x) => x.startsWith('document.read') || x.startsWith('document.write') || x.startsWith('tools')).length == 0}
|
||||||
<p class="m-8 text-center text-2xl">
|
<p class="m-8 text-center text-2xl">
|
||||||
No modules are available. Please check your account with admin.
|
No modules are available. Please wait a seconds or check your account with admin.
|
||||||
</p>
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue