added redirect to /write when using wrong path
authorPhiTux <redacted>
Sun, 28 Sep 2025 15:31:23 +0000 (17:31 +0200)
committerPhiTux <redacted>
Sun, 28 Sep 2025 15:31:23 +0000 (17:31 +0200)
frontend/src/routes/[...missing]/+page.server.js [new file with mode: 0644]
frontend/src/routes/login/+page.js

diff --git a/frontend/src/routes/[...missing]/+page.server.js b/frontend/src/routes/[...missing]/+page.server.js
new file mode 100644 (file)
index 0000000..edf1cc9
--- /dev/null
@@ -0,0 +1,8 @@
+import { redirect } from '@sveltejs/kit';
+
+// Catch-all for unknown routes: redirect to /write (primary app surface)
+// If /write itself handles auth, unauthenticated users will still be bounced to /login there.
+// Adjust here if you later want a different fallback (e.g. redirect to /login when not authenticated).
+export function load() {
+       throw redirect(307, '/write');
+}
index 6c35f226679b38b8e87538c828baf56722965233..9ad951ed04d398c1d9ef8632c318db248ed17254 100644 (file)
@@ -1,7 +1,7 @@
 import {redirect} from '@sveltejs/kit'
 
 export const load = () => {
-  const user = JSON.parse(localStorage.getItem('user'));
+  const user = localStorage.getItem('user');
                if (user) {
                        throw redirect(307, '/write');
                }
git clone https://git.99rst.org/PROJECT