Hi @all!,
I have a problem and I don’t know how to solve it properly. Maybe you can help me, or have some ideas on how to fix it.
I have written a next-js application using the authentication method explained in this course “Next.js Projects: Build an Issue Tracker” (prisma adapter, google login via NextAuth).
This is my use case: I want to check if the user is a “new user” after user login (I have some criteria if a user is new, for example, no User bio, etc.). To do this, I need to check the DB via Prisma. If the user is a “new user”, then I want the user to be redirected to a welcome page after login. If the user tries to open another page, they should be redirected back to the welcome page. Only when the user has completed the instructions on the welcome page should the user be able to move freely in the app.
Is there any way to develop this using middleware or something like that?
Many thanks in advance!