I’m sorry 😭
##Changes:
- Use localStorage to store jwt instead of cookies
- Fix signup page unequal width of img and form container
- Changed login.css similar to signup.css for consistent code
- Added login as guest functionality
- Added navigation to /course after signup or login success
- Added UserContext.jsx to handle user data
- Added protectRoute middleware to verify jwt
- Added “/api/user/“ endpoint to get user data from backend
Too many changes, let’s break them down.
I’m sorry that I switched to localStorage to store jwt instead of cookies 😭. The cookie wasn’t working as expected. I was able to store the jwt in the cookie and receive it in the frontend but when I reloaded the cookie would just disappear. I know that there’s a fix for this as I have done this before as well. But, I know that I’ll face the same issue during deployment even if I fix the issue now. I’ll probably deploy this in vercel and last time (in flavortown) I had to change the whole code format due to the cookie issue. So this time I’ll just rely on localStorage for now. If I deploy the website myself then maybe I’ll consider using the cookie. But for now just forgive me 🙏.
I fixed the unequal width of img container and form container with again in signup page. This happened because I added padding to the form-container instead of the form. Using flex for this was a headache so I used grid and it worked.
Although I didn’t necessarily needed to change the login page css. I did it to maintain a consistent codebase.
This is a huge one. I added login as guest functionality. I know that people will be skeptical of entering their email even though they can use any made up email such as [email protected]. I purely added this feature so that people don’t rate me bad just because they assumed that they need their own email to signup. And logging in as guest is easier as well so why not.
Now, after the signup, login or login as guest is successful then we’ll be redirected to the course page. Later I’ll make it so that users who aren’t logged in won’t be able to access any other path except for the “/“.
Also now there’s userContext.jsx for storing and distributing user data. For now there’s getUser function for getting user’s data. I have made the backend work to verify the user’s token and then only provide the user with their data.
Alright no more yapping, the devlog has gotten very long. If anyone has read this devlog, God bless them.
~
Peace ✌️.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.