Question about custom session objects #4223
Answered
by
balazsorban44
randomprogramming
asked this question in
Help
Replies: 1 comment 4 replies
-
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
balazsorban44
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Question 💬
Hello this is my
[...nextauth].ts
file:I needed a way to conditionally render some frontend elements based on the role of the user, but I didn't want to create a separate call to get the user roles from the database, so I ended up with this. The above code prints:
The user schema for Prisma looks like this:
Now I have two questions:
user
parameter in thesession
callback? In the current setup, typescript evaluatesuser.roles
asunknown
which isn't true..How to reproduce ☕️
Entire code is above.
Contributing 🙌🏽
No, I am afraid I cannot help regarding this
Beta Was this translation helpful? Give feedback.
All reactions