From 3f5eb8d07dd44cf8107b63550619aba7410cc52d Mon Sep 17 00:00:00 2001 From: "pakintada@gmail.com" Date: Sun, 15 Mar 2026 09:03:33 +0700 Subject: [PATCH] fix: permission missing if refresh Signed-off-by: pakintada@gmail.com --- src/routes/(authed)/entry/+layout.svelte | 8 ++++---- src/routes/(authed)/entry/+page.svelte | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/routes/(authed)/entry/+layout.svelte b/src/routes/(authed)/entry/+layout.svelte index 95eb23f..cd92764 100644 --- a/src/routes/(authed)/entry/+layout.svelte +++ b/src/routes/(authed)/entry/+layout.svelte @@ -1,7 +1,8 @@ @@ -10,5 +11,4 @@ Taobin Management Tools - -{@render children()} \ No newline at end of file +{@render children()} diff --git a/src/routes/(authed)/entry/+page.svelte b/src/routes/(authed)/entry/+page.svelte index 4f4e4b7..7cca677 100644 --- a/src/routes/(authed)/entry/+page.svelte +++ b/src/routes/(authed)/entry/+page.svelte @@ -8,6 +8,7 @@ import ArrowRight from '@lucide/svelte/icons/arrow-right'; import { permission as currentPermissions } from '$lib/core/stores/permissions'; import { get } from 'svelte/store'; + import { onMount } from 'svelte'; let recipeModBtn = $state(null); let monitorModBtn = $state(null); @@ -16,6 +17,8 @@ let animationPulseGoto: JSAnimation; + let perms = $state([]); + setInterval(() => { if (gotoDashboardBtn && !animationPulseGoto) { animationPulseGoto = animate(gotoDashboardBtn, { @@ -30,7 +33,16 @@ } }, 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; + } + }); + });
@@ -101,7 +113,7 @@ {#if perms.filter((x) => x.startsWith('document.read') || x.startsWith('document.write') || x.startsWith('tools')).length == 0}

- No modules are available. Please check your account with admin. + No modules are available. Please wait a seconds or check your account with admin.

{/if}