Accessing session data outside of react lifecycles #5048
Unanswered
always-maap
asked this question in
Help
Replies: 0 comments
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi. using
getSession()
outside of react component will trigger api call to/api/auth/session
. This is necessary to write a wrapper around api calls(fetch, axios, graphqlClient) and separate apis from the application(not using useAxios, useFetch, ...).Maybe we should add a section in the doc. and suggest a solution or workarounds since it's common problem. TY
related discussions:
How can I attach my JWT to every axios call?:
How can I get the session data within axios interceptor without calling /api/auth/session ?
Is this a good way to handle headers?
Beta Was this translation helpful? Give feedback.
All reactions