fix: avoid flash target page show

This commit is contained in:
2025-05-29 12:43:39 +02:00
parent 56755ac531
commit 8364a8e9ec
2 changed files with 19 additions and 13 deletions

View File

@ -17,6 +17,9 @@ export interface IAuthState {
accounts: LocalAccount[];
signInRequired: boolean;
hasAuthenticated: boolean;
hasLoadedAccounts: boolean;
loadAccounts: () => Promise<void>;
updateActiveAccount: (account: LocalAccount) => Promise<void>;
authenticate: () => Promise<void>;
@ -47,6 +50,9 @@ export const useAuth = create<IAuthState>((set, get) => ({
loadingAccounts: false,
signInRequired: false,
hasAuthenticated: false,
hasLoadedAccounts: false,
updateActiveAccount: async (account) => {
set({ activeAccount: account });
@ -82,7 +88,12 @@ export const useAuth = create<IAuthState>((set, get) => ({
set({ signInRequired: true });
}
set({ activeAccount: account, accounts, loadingAccounts: false });
set({
activeAccount: account,
accounts,
loadingAccounts: false,
hasLoadedAccounts: true,
});
},
authenticate: async () => {
@ -114,7 +125,7 @@ export const useAuth = create<IAuthState>((set, get) => ({
// TODO: set error
console.log(err);
} finally {
set({ authenticating: false });
set({ authenticating: false, hasAuthenticated: true });
}
},