Hello Everyone , i need help in my MERN project
i have created the project and Created a login form and signup form , When i log in , the credentials are checked and the user get logged in and the user Dashboard is shown
But When i refresh the page or the page gets refresh , the user got back to the login/signup page
I want to create a session type something that will make the user logged in even if the page gets refresh and only see the login/signup when the user log out by themselves
THANK YOU
Top comments (4)
You can store user ID in cookies or localStorage once user login. If anyone( user ) open/ refresh your website, you will request user data by user ID, and handle the user data( ex: using redux or something ) on your website. ๐
So on log out i have to clear the cookies?
If the user logout, you should definitely clear cookies, else don't!
okay Thank you