feat: add assessment, privacy and support flows
This commit is contained in:
1 parent
ee3738ee73
commit
e4f24fa202
339 files changed
+56454
-1126
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import type { QueryClient } from "@tanstack/react-query";
|
||||
import { getGetCurrentSessionQueryKey } from "../../../shared/api/endpoints/identity/identity";
|
||||
import type { Session } from "../../../shared/api/schemas";
|
||||
|
||||
/** Checks that a response still belongs to the active account and CSRF session. */
|
||||
export function isNeedSessionCurrent(
|
||||
queryClient: QueryClient,
|
||||
session: Session | undefined,
|
||||
): boolean {
|
||||
if (!session?.csrf_token) return false;
|
||||
const state = queryClient.getQueryState<Session>(getGetCurrentSessionQueryKey());
|
||||
return Boolean(
|
||||
state?.status === "success" &&
|
||||
state.data?.account.id === session.account.id &&
|
||||
state.data.csrf_token === session.csrf_token,
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user