Update app/admin/page.tsx

This commit is contained in:
2025-06-23 14:26:33 +03:00
parent d97510c2d2
commit 40e22110ed

View File

@@ -315,6 +315,13 @@ export default function AdminPage() {
setUser(parsedUser) setUser(parsedUser)
}, [router]) }, [router])
// Add this right after the existing useEffect that sets the user
useEffect(() => {
// Force initial fetch when user changes
if (user?.national_id) {
refetchGlobal()
}
}, [user?.national_id, refetchGlobal])
useEffect(() => { useEffect(() => {
if (globalResetCooldown > 0) { if (globalResetCooldown > 0) {
const timer = setTimeout(() => setGlobalResetCooldown(globalResetCooldown - 1), 1000) const timer = setTimeout(() => setGlobalResetCooldown(globalResetCooldown - 1), 1000)