feat: middleware can call renderNotFound (#1975)

This commit is contained in:
Reed von Redwitz
2023-10-27 23:34:49 +02:00
committed by GitHub
parent 67c795731d
commit f5dd55443b
8 changed files with 275 additions and 199 deletions
+10
View File
@@ -433,6 +433,15 @@ export interface UnknownPage {
inheritLayouts: boolean;
}
export type UnknownRenderFunction = (
req: Request,
params: Record<string, string>,
// deno-lint-ignore no-explicit-any
ctx?: any,
data?: unknown,
error?: unknown,
) => Promise<Response>;
// --- ERROR PAGE ---
export interface ErrorPageProps {
@@ -488,6 +497,7 @@ export interface ErrorPage {
export interface MiddlewareHandlerContext<State = Record<string, unknown>>
extends ServeHandlerInfo {
next: () => Promise<Response>;
renderNotFound: (state?: State) => Response | Promise<Response>;
state: State;
destination: router.DestinationKind;
params: Record<string, string>;