Start integrating the onboarding flow with backend 2

This commit is contained in:
Urtzi Alfaro
2025-09-04 18:59:56 +02:00
parent a11fdfba24
commit 9eedc2e5f2
30 changed files with 3432 additions and 4735 deletions

View File

@@ -75,7 +75,8 @@ export const useTenantStore = create<TenantState>()(
set({ isLoading: true, error: null });
// Get current user to determine user ID
const user = useAuthUser.getState?.() || JSON.parse(localStorage.getItem('auth-storage') || '{}')?.state?.user;
const authState = JSON.parse(localStorage.getItem('auth-storage') || '{}')?.state;
const user = authState?.user;
if (!user?.id) {
throw new Error('User not authenticated');
@@ -130,7 +131,8 @@ export const useTenantStore = create<TenantState>()(
if (!currentTenant) return false;
// Get user to determine role within this tenant
const user = useAuthUser.getState?.() || JSON.parse(localStorage.getItem('auth-storage') || '{}')?.state?.user;
const authState = JSON.parse(localStorage.getItem('auth-storage') || '{}')?.state;
const user = authState?.user;
// Admin role has all permissions
if (user?.role === 'admin') return true;