context.session.$authorize()
vs resolver.authorize()
#2472
-
Hey, import { Ctx, resolver } from "blitz"
export default resolver.pipe(resolver.authorize(), async ({ id }, context: Ctx) => {
const user = context.session.userId // user: number | null
}) When I use import { Ctx, resolver } from "blitz"
export default resolver.pipe(async ({ id }, context: Ctx) => {
context.session.$authorize()
const user = context.session.userId // user: number
}) I thought antony :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Here's the fix. Don't use -import { Ctx, resolver } from "blitz"
+import { resolver } from "blitz"
-export default resolver.pipe(resolver.authorize(), async ({ id }, context: Ctx) => {
+export default resolver.pipe(resolver.authorize(), async ({ id }, context) => {
const user = context.session.userId // user: number | null
}) |
Beta Was this translation helpful? Give feedback.
Here's the fix. Don't use
Ctx
when you useresolver.x
:)