ultisuite-client/lib/auth/clear-client-auth-state.ts
R3D347HR4Y 9ea2d3325d
Some checks are pending
E2E / Playwright e2e (push) Waiting to run
feat(auth): enhance authentication flows with embedded support and UI improvements
- Updated login and signup components to utilize AuthCard for better user experience during redirection.
- Introduced AuthentikEmbedDialog for seamless integration of Authentik's identity portal within the application.
- Enhanced password recovery and signup flows with dynamic theme handling and improved loading states.
- Refactored existing components to streamline authentication processes and improve maintainability.
2026-06-21 00:12:45 +02:00

22 lines
776 B
TypeScript

"use client"
import type { QueryClient } from "@tanstack/react-query"
import { AUTH_STORAGE_KEY, LEGACY_AUTH_KEYS, useAuthStore } from "@/lib/api/auth-store"
import { flushPersistStorage } from "@/lib/stores/debounced-json-storage"
import { useAccountStore } from "@/lib/stores/account-store"
/** Drop in-memory auth, cached API data, and persisted profile chrome. */
export function clearClientAuthState(queryClient?: QueryClient) {
useAuthStore.getState().logout()
queryClient?.clear()
useAccountStore.setState({ activeAccountId: null, otherAccountsExpanded: true })
if (typeof window === "undefined") return
localStorage.removeItem(AUTH_STORAGE_KEY)
for (const legacy of LEGACY_AUTH_KEYS) {
localStorage.removeItem(legacy)
}
flushPersistStorage()
}