Some checks are pending
E2E / Playwright e2e (push) Waiting to run
- 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.
22 lines
776 B
TypeScript
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()
|
|
}
|