nathanielfernandes / cps630-project

4 stars 0 forks source link

redirect user if user visits protected page while not logged in #31

Closed Dev-Zhao closed 4 months ago

Dev-Zhao commented 4 months ago

Resolves #30

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.