Best way to implement team/account switching functionality using App router. #61719
Unanswered
devforbetter
asked this question in
Help
Replies: 1 comment
-
@devforbetter what did you end up implementing? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
Using the new App router, I am trying to find the best way to implement team or account switching functionality. Once logged in the user will be able to select the team or account that uses dropdown via useContext but I need to then make api calls based on what team has been selected using the team ID.
I have the switcher / dropdown working using server components but what is the best way to access that current selected team and then make external API calls after that?
Is it to save the selected team ID in a cookie or localstorage? Or update the auth.js session adding the teams ID? Or can I somehow pass this team ID down using useContext with the above? But useContext can only be used in client components. Or do I just useContext in a client component and make my API calls using useEffect?
Just wanted to find out that what the best/recommended method of implementing such features would be.
Thanks in advance for any advice, any examples would be great too!
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions