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.
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.