You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi is there a way, to not to do a request when there is no jwt token in localStorage?
It should just render the login page
Now it is doing an unneccessary empty request, and the response is also empty. so the userInfo is null.
We should be able to skip that.., do you know how?
The text was updated successfully, but these errors were encountered:
What you can do is, wrap with AuthProvider only when the token is available in the localStorage. Otherwise don't wrap with AuthProvider?
For example: if you have a Login component which might need to check whether user has a valid session or not depending on whether token is available in the localStorage, here is how the React code will look like
My whole application is wrapped with the AuthProvider which has my App Router beneath.
Actually a prop in the AuthProvider could fix this very easily.. Like makeRequest={true || false} or so..
Hi is there a way, to not to do a request when there is no jwt token in localStorage?
It should just render the login page
Now it is doing an unneccessary empty request, and the response is also empty. so the userInfo is null.
We should be able to skip that.., do you know how?
The text was updated successfully, but these errors were encountered: