Currently, I'm working on a classified ads website where I'm using ReactJS on the front-end. Unfortunately, right now I have some troubles with cookies behaviour so I'm trying to find where the issue is, but no luck for many days. The problem is, I'm using cookies to save user email and user id in cookies to check if it is logged in or out. For some reason, sometimes the page must be refreshed to get user email and id from cookies. The second problem is that after the user is logged out, navigating through pages and refreshing the site, the user is logged in again and I have no idea how this is happening.
Please, check the video to see the bug in action https://youtu.be/Xrhw2Oa9_1k
Link to the repository https://github.com/tourniquet/classified-frontend-react
Also, if there are some good tutorials on how to manage logged user data, please don't hesitate to share them with me. Thank you in advance!