From e3f35643135d51b292f4debaef038d97c67a0b7f Mon Sep 17 00:00:00 2001 From: mbaharip <62494292+mbahArip@users.noreply.github.com> Date: Thu, 25 May 2023 22:39:49 +0700 Subject: [PATCH] Add not found if error code 404 --- src/app/[...path]/page.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/[...path]/page.tsx b/src/app/[...path]/page.tsx index c83b30d..b1d8276 100644 --- a/src/app/[...path]/page.tsx +++ b/src/app/[...path]/page.tsx @@ -1,5 +1,6 @@ import { Metadata, ResolvingMetadata } from "next"; import { cookies } from "next/headers"; +import { notFound } from "next/navigation"; import Breadcrumb from "components/compBreadcrumb"; import FileLayout from "components/compFileLayout"; @@ -119,6 +120,9 @@ async function FilePage({ params }: Props) { if (!pathValidation.success) { const errorData = pathValidation as API_Error; + if (errorData.code === 404) { + notFound(); + } const payload = handleError(errorData); throw new Error(payload); }