fix: restore auth and auto-open last project

This commit is contained in:
DhanushSantosh
2026-01-11 20:43:55 +05:30
parent 6e4b611662
commit 785a4d2c3b
8 changed files with 378 additions and 30 deletions

View File

@@ -5,6 +5,8 @@ interface AuthState {
authChecked: boolean;
/** Whether the user is currently authenticated (web mode: valid session cookie) */
isAuthenticated: boolean;
/** Whether settings have been loaded and hydrated from server */
settingsLoaded: boolean;
}
interface AuthActions {
@@ -15,15 +17,18 @@ interface AuthActions {
const initialState: AuthState = {
authChecked: false,
isAuthenticated: false,
settingsLoaded: false,
};
/**
* Web authentication state.
*
* Intentionally NOT persisted: source of truth is the server session cookie.
* Intentionally NOT persisted: source of truth is server session cookie.
*/
export const useAuthStore = create<AuthState & AuthActions>((set) => ({
...initialState,
setAuthState: (state) => set(state),
setAuthState: (state) => {
set({ ...state });
},
resetAuth: () => set(initialState),
}));

View File

@@ -7,6 +7,7 @@ export interface CliStatus {
path: string | null;
version: string | null;
method: string;
hasApiKey?: boolean;
error?: string;
}