feat(server): add isPartial to context types (#1977)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { MiddlewareHandlerContext } from "$fresh/server.ts";
|
||||
|
||||
export type IsPartialInContextState = {
|
||||
setFromMiddleware: boolean;
|
||||
notSetFromMiddleware: boolean;
|
||||
};
|
||||
|
||||
export async function handler(
|
||||
_req: Request,
|
||||
ctx: MiddlewareHandlerContext<IsPartialInContextState>,
|
||||
) {
|
||||
if (ctx.isPartial) {
|
||||
ctx.state.setFromMiddleware = true;
|
||||
} else {
|
||||
ctx.state.notSetFromMiddleware = true;
|
||||
}
|
||||
return await ctx.next();
|
||||
}
|
||||
Reference in New Issue
Block a user