Skip to content

context.session.$authorize() vs resolver.authorize() #2472

Answered by flybayer
antonykamp asked this question in Q&A
Discussion options

You must be logged in to vote

Here's the fix. Don't use Ctx when you use resolver.x :)

-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
})

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@antonykamp
Comment options

@oyatek
Comment options

Answer selected by antonykamp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants