phantom3313
BABetter Auth
•Created by phantom3313 on 4/22/2025 in #help
Is it okay for getsession req to be made for every protected route or I should cache it?
yeah, using redux or zustand may leave the user hanging in the protected route the session is expired, but no data will be loaded right like we will obviously make sure in the server side that session is present before sending any data. So even if the pages are visible if they make any request, and we receive 401 I can log them out immediately. This was the idea I was having. As for the building case, I think it's the use session it is useful, but the thing is if I only use the protected route as I mentioned in my original post, this will mount unmount the different components each time the path changes so even though we are inside the protected route, it will make a new call to session every time.
7 replies
BABetter Auth
•Created by phantom3313 on 4/22/2025 in #help
Is it okay for getsession req to be made for every protected route or I should cache it?
Is it a good practice if Use a auth context in and wrap the protected routes in it?? so it will make a initial getsession and the response will be saved in context. Since if I terminate this session remotly then even if the user seems to be logged in he cannot make any calls to server?
7 replies