Adittya-Gupta / Ethos

2 stars 12 forks source link

Fix log out on refresh #9

Closed Adittya-Gupta closed 9 months ago

Adittya-Gupta commented 9 months ago

If a person refresh the page, he/she gets logged out and has to login again. Fix this!

maheshwar-verma commented 9 months ago

I want to work on this. Kindly assign this to me.

Adittya-Gupta commented 9 months ago

Sure @maheshwar-verma

maheshwar-verma commented 9 months ago

Ethos i am getting this whenever i refresh the page. is this the error you are talking about?

Adittya-Gupta commented 9 months ago

Nooo.... On refreshing, the user gets log out of the website but in yours it is showing 404 error. I think you haven't set up the environment properly. See the below video to understand what I am talking about

https://github.com/Adittya-Gupta/Ethos/assets/95131750/3f78e987-4981-4be3-b9cc-f2f1218a08f1

maheshwar-verma commented 9 months ago

i am installing it locally , the backend is not installed yet. check out the screenshot carefully its not on localhost. i have tried that using this link https://adittya-gupta.github.io/Ethos-Website/

maheshwar-verma commented 9 months ago

its other issue i guess ,routing problem

Adittya-Gupta commented 9 months ago

Yeah.. please try it on local machine only for now. The issue that you are working on does not require backend services tho. The hosted website link that you quoted is not working properly and is many commits behind. I have to fix that so for the time being please only experiment after installing on local machine

maheshwar-verma commented 9 months ago

okay i got it, but for doing this i need to signup on local , and that's need backend serivces. thats why i am installing that too

Adittya-Gupta commented 9 months ago

No it is done using firebase so it doesn't require it.

maheshwar-verma commented 9 months ago

Hello can you guide me something about this like I have tried many things useEffect and other things but I am still unable to solve this. This is render problem I guess. Any help will be appreciated

Adittya-Gupta commented 9 months ago

Read this https://stackoverflow.com/questions/32253413/how-do-i-keep-a-user-logged-into-a-firebase-app-after-refresh Also it is not a render problem. React apps are recompiled when you reload the page so that's why the user gets logged out. You can also solve this issue by storing data in the local storage of browser

maheshwar-verma commented 9 months ago

i have stored the result which we get at sign in in firebase.js in local storage. then i replaced auth with storedAuth in navbar,dashboard and card components. By doing this the issue gets resolved.

maheshwar-verma commented 9 months ago

https://github.com/Adittya-Gupta/Ethos/assets/115862713/18b979af-cc9a-4c4b-888a-bc21ef898889

Adittya-Gupta commented 9 months ago

Yess looks nice generate a PR so I can review the code....