feat(auth): add registration and verification browser flow
This commit is contained in:
1 parent
391af7a1ef
commit
b2322bc178
41 files changed
+2144
-81
No files matched your search
@@ -2,6 +2,7 @@ import { QueryClientProvider } from "@tanstack/react-query";
|
||||
import { renderToString } from "react-dom/server";
|
||||
import { StaticRouterProvider, createStaticHandler, createStaticRouter } from "react-router-dom";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getGetCurrentSessionQueryKey } from "../../shared/api/endpoints/identity/identity";
|
||||
import { createQueryClient } from "../providers/query-client";
|
||||
import { routes } from "./routes";
|
||||
|
||||
@@ -15,8 +16,32 @@ async function render(path: string): Promise<string | Response> {
|
||||
return context;
|
||||
}
|
||||
const router = createStaticRouter(handler.dataRoutes, context);
|
||||
const queryClient = createQueryClient();
|
||||
const scenario = path.startsWith("/employer") ? "employer" : "candidate";
|
||||
if (path.startsWith("/candidate") || path.startsWith("/employer")) {
|
||||
queryClient.setQueryData(getGetCurrentSessionQueryKey(), {
|
||||
account: {
|
||||
id: "11111111-1111-4111-8111-111111111111",
|
||||
email: "person@example.test",
|
||||
email_verified: true,
|
||||
scenario,
|
||||
onboarding_step:
|
||||
path === "/candidate/onboarding"
|
||||
? "candidate_consents"
|
||||
: path === "/candidate/profile"
|
||||
? "candidate_profile"
|
||||
: path === "/candidate/assessment"
|
||||
? "candidate_assessment"
|
||||
: scenario === "candidate"
|
||||
? "completed"
|
||||
: "employer_company",
|
||||
created_at: "2026-10-07T12:00:00Z",
|
||||
},
|
||||
csrf_token: "A".repeat(43),
|
||||
});
|
||||
}
|
||||
return renderToString(
|
||||
<QueryClientProvider client={createQueryClient()}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<StaticRouterProvider router={router} context={context} hydrate={false} />
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user