nathanielfernandes / cps630-project

4 stars 0 forks source link

protected routes not redirecting #30

Closed nathanielfernandes closed 6 months ago

nathanielfernandes commented 6 months ago

when visiting nested protected routes under dashboard, you can "visit" the page without being signed in.

needs to redirect back to index with a login request.

nathanielfernandes commented 6 months ago

dashboard subpages are just not visible on the deployed build??

Dev-Zhao commented 6 months ago

Currently in hooks.server.ts, we redirect the user if they try to visit protected url without logging in. However, the redirect handle runs only at the server-side, if you navigate through the app after it's loaded, everything is now handled client side. The redirect handle function is only called on fetch requests, initial loads and hard refresh.

I added code to layout component to watch for url changes on the client side, and perform redirects when necessary.