Files
lincodex/frontend/src/shared/config/paths.ts
T

73 lines
3.0 KiB
TypeScript

/**
* Route paths shared by the router (app) and navigation (widgets), so a path
* is defined once. Cabinet paths are absolute and nest under their root.
*/
export const paths = {
home: "/",
login: "/login",
register: "/register",
verifyEmail: "/verify-email",
support: "/support",
status: "/status",
candidate: {
root: "/candidate",
onboarding: "/candidate/onboarding",
profile: "/candidate/profile",
questionnaire: "/candidate/questionnaire",
assessment: "/candidate/assessment",
assessmentAttempt: (attemptId: string) =>
`/candidate/assessment/${encodeURIComponent(attemptId)}`,
results: "/candidate/results",
result: (attemptId: string) => `/candidate/results/${encodeURIComponent(attemptId)}`,
invitations: "/candidate/invitations",
/** One invitation addressed to the current candidate; the id is an opaque UUID. */
invitation: (invitationId: string) =>
`/candidate/invitations/${encodeURIComponent(invitationId)}`,
notifications: "/candidate/notifications",
privacy: "/candidate/privacy",
supportCases: "/candidate/support/cases",
supportNew: "/candidate/support/cases/new",
supportManual: "/candidate/support/cases/manual-assessment",
supportCase: (caseId: string) => `/candidate/support/cases/${encodeURIComponent(caseId)}`,
},
employer: {
root: "/employer",
company: "/employer/company",
needs: "/employer/needs",
needNew: (organizationId?: string) =>
organizationId
? `/employer/needs/new?organization_id=${encodeURIComponent(organizationId)}`
: "/employer/needs/new",
need: (needId: string, organizationId: string) =>
`/employer/needs/${encodeURIComponent(needId)}?organization_id=${encodeURIComponent(organizationId)}`,
candidates: "/employer/candidates",
/** The candidate search with one need of the organization preselected. */
candidatesForNeed: (needId: string, organizationId: string) =>
`/employer/candidates?organization_id=${encodeURIComponent(organizationId)}&need_id=${encodeURIComponent(needId)}`,
invitations: "/employer/invitations",
invitationNew: "/employer/invitations/new",
/**
* Opens the invitation form for one search result. The handle is the
* organization-scoped alias from the search, never a candidate identifier.
*/
inviteCandidate: (input: {
organizationId: string;
candidateHandle: string;
specialization: string;
needId?: string | undefined;
}) => {
const query = new URLSearchParams({
organization_id: input.organizationId,
candidate_handle: input.candidateHandle,
specialization: input.specialization,
});
if (input.needId) query.set("need_id", input.needId);
return `/employer/invitations/new?${query.toString()}`;
},
notifications: "/employer/notifications",
supportCases: "/employer/support/cases",
supportNew: "/employer/support/cases/new",
supportCase: (caseId: string) => `/employer/support/cases/${encodeURIComponent(caseId)}`,
},
} as const;