Setting user's role on the client side upon logging in
Unanswered
Capple posted this in #help-forum
CappleOP
Hello,
I'm currently in the process of migrating to app router.
I have a feature in my project, that allows the admin user to swap to user view. I'm storing the currentRole/currentView in my Zustand store.
I was thinking of making a separate client component, passing the session from the root layout to it and then update the currentRole in the useEffect, but it feels wrong. What would be the best approach to setting the initial role upon logging in?
I'm currently in the process of migrating to app router.
I have a feature in my project, that allows the admin user to swap to user view. I'm storing the currentRole/currentView in my Zustand store.
I was thinking of making a separate client component, passing the session from the root layout to it and then update the currentRole in the useEffect, but it feels wrong. What would be the best approach to setting the initial role upon logging in?