Start integrating the onboarding flow with backend 2
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user