From ce080eca959bc529b2bbb2a5efd0a1ac2507fc69 Mon Sep 17 00:00:00 2001 From: mbaharip <62494292+mbahArip@users.noreply.github.com> Date: Sun, 28 May 2023 01:04:57 +0700 Subject: [PATCH] Remove: redirect to password page --- src/app/(__components)/compFileLayout.tsx | 8 +++++--- src/app/[...path]/page.tsx | 14 -------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/app/(__components)/compFileLayout.tsx b/src/app/(__components)/compFileLayout.tsx index d500ff4..64c1627 100644 --- a/src/app/(__components)/compFileLayout.tsx +++ b/src/app/(__components)/compFileLayout.tsx @@ -38,8 +38,8 @@ function FileLayout({ data }: Props) { ); useEffect(() => { - const files = clientData.files.length; - const folders = clientData.folders.length; + const files = clientData.files.length ?? 0; + const folders = clientData.folders.length ?? 0; setTotalItems(files + folders); }, [clientData]); @@ -67,7 +67,9 @@ function FileLayout({ data }: Props) { return ( <> {layout === "grid" ? ( - + <> + + ) : ( )} diff --git a/src/app/[...path]/page.tsx b/src/app/[...path]/page.tsx index e737342..4e0cfdc 100644 --- a/src/app/[...path]/page.tsx +++ b/src/app/[...path]/page.tsx @@ -1,6 +1,5 @@ import { Metadata, ResolvingMetadata } from "next"; import { cookies } from "next/headers"; -import { notFound, redirect } from "next/navigation"; import Breadcrumb from "components/compBreadcrumb"; import FileLayout from "components/compFileLayout"; @@ -121,19 +120,6 @@ async function FilePage({ params }: Props) { if (!pathValidation.success) { const errorData = pathValidation as API_Error; - if (errorData.code === 401) { - const protectedPath = errorData.reason - .split('"')[1] - .split('"')[0]; - redirect( - `/password?redirect=${params.path.join( - "/", - )}&path=${protectedPath}`, - ); - } - if (errorData.code === 404) { - notFound(); - } const payload = handleError(errorData); throw new Error(payload); }