mirror of
https://github.com/9technologygroup/patchmon.net.git
synced 2025-11-09 08:26:16 +00:00
Addeed detailed logging to track first time admin setup
This commit is contained in:
@@ -17,6 +17,11 @@ export const AuthProvider = ({ children }) => {
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
const [permissionsLoading, setPermissionsLoading] = useState(false)
|
||||
const [needsFirstTimeSetup, setNeedsFirstTimeSetup] = useState(false)
|
||||
|
||||
// Debug: Log when needsFirstTimeSetup changes
|
||||
useEffect(() => {
|
||||
console.log('needsFirstTimeSetup changed to:', needsFirstTimeSetup)
|
||||
}, [needsFirstTimeSetup])
|
||||
const [checkingSetup, setCheckingSetup] = useState(true)
|
||||
|
||||
// Initialize auth state from localStorage
|
||||
@@ -233,6 +238,7 @@ export const AuthProvider = ({ children }) => {
|
||||
if (response.ok) {
|
||||
const data = await response.json()
|
||||
console.log('Admin check response:', data) // Debug log
|
||||
console.log('hasAdminUsers:', data.hasAdminUsers, 'Setting needsFirstTimeSetup to:', !data.hasAdminUsers)
|
||||
setNeedsFirstTimeSetup(!data.hasAdminUsers)
|
||||
} else {
|
||||
console.log('Admin check failed:', response.status, response.statusText) // Debug log
|
||||
|
||||
Reference in New Issue
Block a user