chore: redirect to /500 if pathname does not exist + better error handling (#18615)

* fix lint error

* fix booking page and better error handling
This commit is contained in:
Benny Joo authored and GitHub committed 2025-01-13 00:04:36 +00:00
1 parent e07b1eda32
commit b3ed6e39e3
3 files changed
+9 -6

No files matched your search

+5
View File
@@ -2,6 +2,7 @@ import { _generateMetadata, getTranslate } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { headers } from "next/headers";
import Link from "next/link";
import { redirect } from "next/navigation";
import {
getOrgDomainConfigFromHostname,
@@ -52,6 +53,10 @@ async function NotFound() {
const host = headersList.get("x-forwarded-host") ?? "";
const pathname = headersList.get("x-pathname") ?? "";
if (!pathname) {
redirect("/500");
}
const { username, pageType, url } = getPageInfo(pathname, host);
const isBookingSuccessPage = pathname?.startsWith("/booking");
const isSubpage = pathname?.includes("/", 2) || isBookingSuccessPage;