Merge branch 'pr-169'
# Conflicts: # client/src/i18n/translations/ar.ts # client/src/i18n/translations/br.ts # client/src/i18n/translations/cs.ts # client/src/i18n/translations/de.ts # client/src/i18n/translations/en.ts # client/src/i18n/translations/es.ts # client/src/i18n/translations/fr.ts # client/src/i18n/translations/hu.ts # client/src/i18n/translations/it.ts # client/src/i18n/translations/nl.ts # client/src/i18n/translations/ru.ts # client/src/i18n/translations/zh.ts # client/src/pages/SettingsPage.tsx
This commit is contained in:
@@ -31,7 +31,8 @@ interface AuthState {
|
||||
completeMfaLogin: (mfaToken: string, code: string) => Promise<AuthResponse>
|
||||
register: (username: string, email: string, password: string) => Promise<AuthResponse>
|
||||
logout: () => void
|
||||
loadUser: () => Promise<void>
|
||||
/** Pass `{ silent: true }` to refresh the user without toggling global isLoading (avoids unmounting protected routes). */
|
||||
loadUser: (opts?: { silent?: boolean }) => Promise<void>
|
||||
updateMapsKey: (key: string | null) => Promise<void>
|
||||
updateApiKeys: (keys: Record<string, string | null>) => Promise<void>
|
||||
updateProfile: (profileData: Partial<User>) => Promise<void>
|
||||
@@ -133,13 +134,14 @@ export const useAuthStore = create<AuthState>((set, get) => ({
|
||||
})
|
||||
},
|
||||
|
||||
loadUser: async () => {
|
||||
loadUser: async (opts?: { silent?: boolean }) => {
|
||||
const silent = !!opts?.silent
|
||||
const token = get().token
|
||||
if (!token) {
|
||||
set({ isLoading: false })
|
||||
if (!silent) set({ isLoading: false })
|
||||
return
|
||||
}
|
||||
set({ isLoading: true })
|
||||
if (!silent) set({ isLoading: true })
|
||||
try {
|
||||
const data = await authApi.me()
|
||||
set({
|
||||
|
||||
Reference in New Issue
Block a user