Fixed isAuthenticated function

This commit is contained in:
Muhammad Ibrahim
2025-09-21 22:55:38 +01:00
parent a4770e5106
commit a268f6b8f1

View File

@@ -22,9 +22,10 @@ import FirstTimeAdminSetup from './components/FirstTimeAdminSetup'
function AppRoutes() { function AppRoutes() {
const { needsFirstTimeSetup, checkingSetup, isAuthenticated } = useAuth() const { needsFirstTimeSetup, checkingSetup, isAuthenticated } = useAuth()
const isAuth = isAuthenticated() // Call the function to get boolean value
// Debug logging // Debug logging
console.log('AppRoutes state:', { needsFirstTimeSetup, checkingSetup, isAuthenticated }) console.log('AppRoutes state:', { needsFirstTimeSetup, checkingSetup, isAuthenticated: isAuth })
// Show loading while checking if setup is needed // Show loading while checking if setup is needed
if (checkingSetup) { if (checkingSetup) {
@@ -40,7 +41,7 @@ function AppRoutes() {
} }
// Show first-time setup if no admin users exist // Show first-time setup if no admin users exist
if (needsFirstTimeSetup && !isAuthenticated) { if (needsFirstTimeSetup && !isAuth) {
console.log('Showing FirstTimeAdminSetup component...') console.log('Showing FirstTimeAdminSetup component...')
return <FirstTimeAdminSetup /> return <FirstTimeAdminSetup />
} }