From b6e50df81dc9fc1acae188e13d5d33c9c0e4d2ed Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 18 Sep 2025 07:29:49 +0000 Subject: [PATCH] Fix: Clear auth state when no user data is returned Co-authored-by: tumurbarsnarantuya --- apps/portal/src/features/auth/services/auth.store.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/portal/src/features/auth/services/auth.store.ts b/apps/portal/src/features/auth/services/auth.store.ts index af1e644c..bbbb01d4 100644 --- a/apps/portal/src/features/auth/services/auth.store.ts +++ b/apps/portal/src/features/auth/services/auth.store.ts @@ -343,7 +343,15 @@ export const useAuthStore = create()( if (user) { set({ user, isAuthenticated: true, loading: false, error: null, hasCheckedAuth: true }); } else { - set({ loading: false, hasCheckedAuth: true }); + // No user data returned, clear auth state + set({ + user: null, + tokens: null, + isAuthenticated: false, + loading: false, + error: null, + hasCheckedAuth: true, + }); } } catch (error) { // Token is invalid, clear auth state