From 15cb6b8d7967e9586c35c0d51e97c7804e28bd7c Mon Sep 17 00:00:00 2001 From: obeys Date: Wed, 18 Dec 2024 01:07:39 +0000 Subject: [PATCH] fix: redirect to a shared 404 page --- src/components/404.ts | 27 --------------------------- src/controllers/404.ts | 6 ++---- src/router.ts | 4 ++-- 3 files changed, 4 insertions(+), 33 deletions(-) delete mode 100644 src/components/404.ts diff --git a/src/components/404.ts b/src/components/404.ts deleted file mode 100644 index 0d91604..0000000 --- a/src/components/404.ts +++ /dev/null @@ -1,27 +0,0 @@ -export function create404Page(): string { - return ` -
-
-

Sorry!

-

We can't seem to find the page you're looking for

- - -
- -
- 404 -
-
-`; -} diff --git a/src/controllers/404.ts b/src/controllers/404.ts index 24a1af5..72f85aa 100644 --- a/src/controllers/404.ts +++ b/src/controllers/404.ts @@ -1,11 +1,9 @@ -import { create404Page } from "../components/404"; -export async function load404Page() { +export async function redirectTo404() { const contentArea = document.getElementById("content-area"); if (contentArea) { try { - const content = create404Page(); - contentArea.innerHTML = content; + window.location.href = "https://dao.ubq.fi/404"; } catch (error) { console.error("Failed to load 404 page:", error); } diff --git a/src/router.ts b/src/router.ts index 84ba80e..3dcba4a 100644 --- a/src/router.ts +++ b/src/router.ts @@ -1,6 +1,6 @@ import { loadPage1 } from "./controllers/page1"; import { loadPage2 } from "./controllers/page2"; -import { load404Page } from "./controllers/404"; +import { redirectTo404 } from "./controllers/404"; import { loadHomePage } from "./controllers/home"; // URL Path based routing @@ -25,7 +25,7 @@ export async function handleRouting() { break; default: // Redirect to 404 page if no route matches - await load404Page(); + await redirectTo404(); break; } }