-
-
Notifications
You must be signed in to change notification settings - Fork 815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug Report: User login requires refresh to fetch data #1498
Comments
@palisadoes Please assign me this issue. |
After debugging the issue, I found the reason why this is happening. The header for the HTTP server is not set with the token after a successful login.
This piece of code in index.js sets the header with the token initially as null when the client starts, but the header value dynamically does not change as the value changes in local storage. That's why it needs a refresh after login to fetch the token from local storage and set the header. To fix this, we have a few options: First: Use the setContext function from ApolloClient to update the header dynamically as the value changes in local storage. It requires a few changes in how the ApolloClient is created in the index.js file. Second: Pass the header along with the request. Example: Third:: use window.location.replace('url') after successful login to redirect the user. @palisadoes I'd appreciate your view on this. |
Open a PR. Discuss your approach with the reviewers |
This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue. |
Describe the bug
After logging as user we need to refresh the page to fetch the data.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Data of the user should be fetched after successful login.
Actual behavior
Data is not fetched properly after the login, need to refresh to the page to get the data.
Screenshots
If applicable, add screenshots to help explain your problem.
Screencast.from.26-01-24.12.49.00.AM.IST.mp4
Additional details
Add any other context or screenshots about the feature request here.
Potential internship candidates
Please read this if you are planning to apply for a Palisadoes Foundation internship PalisadoesFoundation/talawa#359
The text was updated successfully, but these errors were encountered: