@dwp/govuk-casa
Version:
A framework for building GOVUK Collect-And-Submit-Applications
44 lines (43 loc) • 1.12 kB
TypeScript
/**
* Create an instance of the router for all waypoints visited during a Journey
* through the Plan.
*
* @param {JourneyRouterOptions} opts Options
* @returns {MutableRouter} Router
* @access private
*/
export default function journeyRouter({ globalHooks, pages, plan, csrfMiddleware, globalErrorVisibility, }: JourneyRouterOptions): MutableRouter;
export function generateGovukErrors(errors: Record<string, ValidationError>, req: import("express").Request): GovUkErrorObject[];
export type ValidationError = import("../casa.js").ValidationError;
export type GovUkErrorObject = {
/**
* Error message text
*/
text: string;
/**
* Error message anchor href
*/
href: string;
};
/**
* Options to configure static router
*/
export type JourneyRouterOptions = {
/**
* Global hooks
*/
globalHooks: GlobalHook[];
/**
* Page definitions
*/
pages: Page[];
/**
* Plan
*/
plan: Plan;
/**
* Middleware for providing CSRF controls
*/
csrfMiddleware: Function[];
};
import MutableRouter from "../lib/MutableRouter.js";