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
@@ -1,4 +1,7 @@
|
||||
import { redirect, type RouteObject } from "react-router-dom";
|
||||
import { LoginPage, RegisterPage, VerifyEmailPage } from "../../pages/auth";
|
||||
import { CandidateOnboardingPage } from "../../pages/candidate-onboarding";
|
||||
import { SessionGate } from "../../entities/session";
|
||||
import { NotFoundPage } from "../../pages/not-found";
|
||||
import { PlaceholderPage } from "../../pages/placeholder";
|
||||
import { StatusPage } from "../../pages/status";
|
||||
@@ -9,11 +12,11 @@ import { EmployerShell } from "../../widgets/employer-shell";
|
||||
import { PublicShell } from "../../widgets/public-shell";
|
||||
import { RootLayout } from "../ui/root-layout";
|
||||
import { RouteErrorPage } from "../ui/route-error-page";
|
||||
import { CandidateHomeRoute } from "./candidate-home-route";
|
||||
|
||||
/**
|
||||
* Route tree with three groups: public pages, the candidate cabinet, and the
|
||||
* employer cabinet. Each group has its own shell and its own not-found page.
|
||||
* Access control is not implemented yet; the server will enforce it.
|
||||
* Route tree with public pages and role-specific cabinets. Protected shells
|
||||
* restore the server session before they render any cabinet child.
|
||||
*/
|
||||
export const routes: RouteObject[] = [
|
||||
{
|
||||
@@ -24,9 +27,9 @@ export const routes: RouteObject[] = [
|
||||
element: <PublicShell />,
|
||||
children: [
|
||||
{ index: true, element: <WelcomePage /> },
|
||||
{ path: paths.login, element: <PlaceholderPage screen="login" /> },
|
||||
{ path: paths.register, element: <PlaceholderPage screen="register" /> },
|
||||
{ path: paths.verifyEmail, element: <PlaceholderPage screen="verifyEmail" /> },
|
||||
{ path: paths.login, element: <LoginPage /> },
|
||||
{ path: paths.register, element: <RegisterPage /> },
|
||||
{ path: paths.verifyEmail, element: <VerifyEmailPage /> },
|
||||
{ path: paths.support, element: <PlaceholderPage screen="support" /> },
|
||||
{ path: paths.status, element: <StatusPage /> },
|
||||
{ path: "*", element: <NotFoundPage /> },
|
||||
@@ -36,27 +39,38 @@ export const routes: RouteObject[] = [
|
||||
path: paths.candidate.root,
|
||||
element: <CandidateShell />,
|
||||
children: [
|
||||
{ index: true, element: <PlaceholderPage screen="candidateHome" /> },
|
||||
{
|
||||
path: paths.candidate.onboarding,
|
||||
element: <PlaceholderPage screen="candidateOnboarding" />,
|
||||
},
|
||||
{ path: paths.candidate.profile, element: <PlaceholderPage screen="candidateProfile" /> },
|
||||
{
|
||||
path: paths.candidate.assessment,
|
||||
element: <PlaceholderPage screen="candidateAssessment" />,
|
||||
},
|
||||
{ path: paths.candidate.results, element: <PlaceholderPage screen="candidateResults" /> },
|
||||
{
|
||||
path: paths.candidate.invitations,
|
||||
element: <PlaceholderPage screen="candidateInvitations" />,
|
||||
},
|
||||
{ path: paths.candidate.privacy, element: <PlaceholderPage screen="candidatePrivacy" /> },
|
||||
{
|
||||
path: "*",
|
||||
element: (
|
||||
<NotFoundPage homePath={paths.candidate.root} homeLabel="В кабинет кандидата" />
|
||||
),
|
||||
element: <SessionGate scenario="candidate" />,
|
||||
children: [
|
||||
{ index: true, element: <CandidateHomeRoute /> },
|
||||
{ path: paths.candidate.onboarding, element: <CandidateOnboardingPage /> },
|
||||
{
|
||||
path: paths.candidate.profile,
|
||||
element: <PlaceholderPage screen="candidateProfile" />,
|
||||
},
|
||||
{
|
||||
path: paths.candidate.assessment,
|
||||
element: <PlaceholderPage screen="candidateAssessment" />,
|
||||
},
|
||||
{
|
||||
path: paths.candidate.results,
|
||||
element: <PlaceholderPage screen="candidateResults" />,
|
||||
},
|
||||
{
|
||||
path: paths.candidate.invitations,
|
||||
element: <PlaceholderPage screen="candidateInvitations" />,
|
||||
},
|
||||
{
|
||||
path: paths.candidate.privacy,
|
||||
element: <PlaceholderPage screen="candidatePrivacy" />,
|
||||
},
|
||||
{
|
||||
path: "*",
|
||||
element: (
|
||||
<NotFoundPage homePath={paths.candidate.root} homeLabel="В кабинет кандидата" />
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -64,23 +78,33 @@ export const routes: RouteObject[] = [
|
||||
path: paths.employer.root,
|
||||
element: <EmployerShell />,
|
||||
children: [
|
||||
// The employer flow starts with the company profile.
|
||||
{ index: true, loader: () => redirect(paths.employer.company) },
|
||||
{ path: paths.employer.company, element: <PlaceholderPage screen="employerCompany" /> },
|
||||
{ path: paths.employer.needs, element: <PlaceholderPage screen="employerNeeds" /> },
|
||||
{
|
||||
path: paths.employer.candidates,
|
||||
element: <PlaceholderPage screen="employerCandidates" />,
|
||||
},
|
||||
{
|
||||
path: paths.employer.invitations,
|
||||
element: <PlaceholderPage screen="employerInvitations" />,
|
||||
},
|
||||
{
|
||||
path: "*",
|
||||
element: (
|
||||
<NotFoundPage homePath={paths.employer.company} homeLabel="В кабинет работодателя" />
|
||||
),
|
||||
element: <SessionGate scenario="employer" />,
|
||||
children: [
|
||||
{ index: true, loader: () => redirect(paths.employer.company) },
|
||||
{
|
||||
path: paths.employer.company,
|
||||
element: <PlaceholderPage screen="employerCompany" />,
|
||||
},
|
||||
{ path: paths.employer.needs, element: <PlaceholderPage screen="employerNeeds" /> },
|
||||
{
|
||||
path: paths.employer.candidates,
|
||||
element: <PlaceholderPage screen="employerCandidates" />,
|
||||
},
|
||||
{
|
||||
path: paths.employer.invitations,
|
||||
element: <PlaceholderPage screen="employerInvitations" />,
|
||||
},
|
||||
{
|
||||
path: "*",
|
||||
element: (
|
||||
<NotFoundPage
|
||||
homePath={paths.employer.company}
|
||||
homeLabel="В кабинет работодателя"
|
||||
/>
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user