Remove login modal state from auth store
This commit is contained in:
@@ -18,11 +18,9 @@ interface BackendState {
|
|||||||
|
|
||||||
interface AuthState {
|
interface AuthState {
|
||||||
isAuthenticated: boolean;
|
isAuthenticated: boolean;
|
||||||
showLoginModal: boolean;
|
|
||||||
isGuestMode: boolean; // Add guest mode flag
|
isGuestMode: boolean; // Add guest mode flag
|
||||||
login: (token: string, isGuest?: boolean) => void;
|
login: (token: string, isGuest?: boolean) => void;
|
||||||
logout: () => void;
|
logout: () => void;
|
||||||
setShowLoginModal: (show: boolean) => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const useBackendStateStoreBase = create<BackendState>()((set) => ({
|
const useBackendStateStoreBase = create<BackendState>()((set) => ({
|
||||||
@@ -104,14 +102,12 @@ export const useAuthStore = create<AuthState>(set => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
isAuthenticated: initialState.isAuthenticated,
|
isAuthenticated: initialState.isAuthenticated,
|
||||||
showLoginModal: false,
|
|
||||||
isGuestMode: initialState.isGuestMode,
|
isGuestMode: initialState.isGuestMode,
|
||||||
|
|
||||||
login: (token, isGuest = false) => {
|
login: (token, isGuest = false) => {
|
||||||
localStorage.setItem('LIGHTRAG-API-TOKEN', token);
|
localStorage.setItem('LIGHTRAG-API-TOKEN', token);
|
||||||
set({
|
set({
|
||||||
isAuthenticated: true,
|
isAuthenticated: true,
|
||||||
showLoginModal: false,
|
|
||||||
isGuestMode: isGuest
|
isGuestMode: isGuest
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -122,8 +118,6 @@ export const useAuthStore = create<AuthState>(set => {
|
|||||||
isAuthenticated: false,
|
isAuthenticated: false,
|
||||||
isGuestMode: false
|
isGuestMode: false
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
setShowLoginModal: (show) => set({ showLoginModal: show })
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user