feat: allow layout and _app overrides (#1611)
This commit is contained in:
@@ -253,6 +253,8 @@ export class ServerContext {
|
||||
component,
|
||||
handler,
|
||||
csp: Boolean(config?.csp ?? false),
|
||||
appLayout: Boolean(config?.appTemplate ?? true),
|
||||
rootLayout: Boolean(config?.rootLayout ?? false),
|
||||
};
|
||||
routes.push(route);
|
||||
} else if (isMiddleware) {
|
||||
@@ -288,6 +290,8 @@ export class ServerContext {
|
||||
component,
|
||||
handler: handler ?? ((req) => router.defaultOtherHandler(req)),
|
||||
csp: Boolean(config?.csp ?? false),
|
||||
appLayout: Boolean(config?.appTemplate ?? true),
|
||||
rootLayout: Boolean(config?.rootLayout ?? false),
|
||||
};
|
||||
} else if (
|
||||
path === "/_500.tsx" || path === "/_500.ts" ||
|
||||
@@ -308,6 +312,8 @@ export class ServerContext {
|
||||
handler: handler ??
|
||||
((req, ctx) => router.defaultErrorHandler(req, ctx, ctx.error)),
|
||||
csp: Boolean(config?.csp ?? false),
|
||||
appLayout: Boolean(config?.appTemplate ?? true),
|
||||
rootLayout: Boolean(config?.rootLayout ?? false),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -971,6 +977,8 @@ const DEFAULT_NOT_FOUND: UnknownPage = {
|
||||
name: "_404",
|
||||
handler: (req) => router.defaultOtherHandler(req),
|
||||
csp: false,
|
||||
appLayout: true,
|
||||
rootLayout: false,
|
||||
};
|
||||
|
||||
const DEFAULT_ERROR: ErrorPage = {
|
||||
@@ -981,6 +989,8 @@ const DEFAULT_ERROR: ErrorPage = {
|
||||
component: DefaultErrorHandler,
|
||||
handler: (_req, ctx) => ctx.render(),
|
||||
csp: false,
|
||||
appLayout: true,
|
||||
rootLayout: false,
|
||||
};
|
||||
|
||||
export function selectSharedRoutes<T>(
|
||||
|
||||
Reference in New Issue
Block a user