4 months agoFor those who blame him, it is just a simple example meant to make you think about how to implement it in your own use case. Also, yeah, the access token must be stored in state and the refresh token as an HttpOnly cookie.
4 months agoWhen vibe coder try to become senior. Do you really think this is good approach?
4 months agoConsider storing a token in http only cookie. Idea is correct, the token location should just be more secure π. π¦
4 months agoCan we do like that user && user. role === 'User' && { then here we call all user related route}
4 months agoBest approach is create a /me route that returns userid and role along with authContex and ping that route on protected route visit or even on the first web visit
4 months agoLooks like junior level. Better make router + protectedRoute files and use them in main.tsx. In production developers use httpsCookies.
4 months agoThis is a very beginners approach. Anyone can add any string to token and hurr rey you logged in π
4 months agoCreate a dummy token in localstorage and yea u got into the private app π₯π₯
4 months agoThis approach is a solid foundation, but a `useNavigate` hook within the protected component itself offers an even cleaner separation of concerns. β¨
