This commit is contained in:
IGNY8 VPS (Salman)
2025-12-08 18:22:10 +00:00
parent 33ad6768ec
commit 9f85ce4f52
11 changed files with 774 additions and 198 deletions

View File

@@ -35,6 +35,7 @@ interface AuthState {
refreshToken: string | null;
isAuthenticated: boolean;
loading: boolean;
_hasHydrated: boolean; // Track if persist has completed rehydration
// Actions
login: (email: string, password: string) => Promise<void>;
@@ -44,6 +45,7 @@ interface AuthState {
setToken: (token: string | null) => void;
refreshToken: () => Promise<void>;
refreshUser: () => Promise<void>;
setHasHydrated: (hasHydrated: boolean) => void;
}
export const useAuthStore = create<AuthState>()(
@@ -53,6 +55,7 @@ export const useAuthStore = create<AuthState>()(
token: null,
isAuthenticated: false,
loading: false, // Always start with loading false - will be set true only during login/register
_hasHydrated: false, // Will be set to true after persist rehydration completes
login: async (email, password) => {
set({ loading: true });