fix: middleware state reset between middlewares (#1500)
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import { MiddlewareHandlerContext } from "$fresh/server.ts";
|
||||
|
||||
export const handler = (_req: Request, ctx: MiddlewareHandlerContext) => {
|
||||
ctx.state.handler2 = "it works";
|
||||
return ctx.next();
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import { HandlerContext, PageProps } from "$fresh/server.ts";
|
||||
|
||||
export const handler = (_req: Request, ctx: HandlerContext) => {
|
||||
ctx.state.handler3 = "it works";
|
||||
return ctx.render();
|
||||
};
|
||||
|
||||
export default function Page(props: PageProps) {
|
||||
return <pre>{JSON.stringify(props.state,null,2)}</pre>;
|
||||
}
|
||||
Reference in New Issue
Block a user