From c898ddf51c862656ad45454cc535472f17f3acb6 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Sat, 10 Feb 2024 20:19:08 -0800 Subject: [PATCH] update download logic and 404 redirect --- src/app/document/view/[slug]/page.tsx | 38 ++++++++++++++------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/app/document/view/[slug]/page.tsx b/src/app/document/view/[slug]/page.tsx index 580efff..4d9c9f4 100644 --- a/src/app/document/view/[slug]/page.tsx +++ b/src/app/document/view/[slug]/page.tsx @@ -1,4 +1,3 @@ -'use client' import styles from './documentViewer.module.css' import { Zilla_Slab } from 'next/font/google' import { saveAs } from 'file-saver' @@ -8,8 +7,8 @@ import { topics as topicList, authors as authorList, } from '../../../db/data' -import { navigate } from '../../../actions' import Link from 'next/link' +import { notFound } from 'next/navigation' const zillaSlab = Zilla_Slab({ subsets: ['latin'], weight: ['500'] }) @@ -32,7 +31,7 @@ export default function Page({ }: Readonly<{ params: { slug: string } }>) { const doc = documents[params.slug] if (!doc) { - navigate('/404') + notFound() return } const { abstract, file } = doc @@ -148,22 +147,25 @@ export default function Page({

{abstract}

{generateTopics()}

{generateCode()}

- + + )