30 lines
835 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { notFound } from 'next/navigation';
import { getPageData } from "@/utils/data";
import { getLocalPageData } from "@/data/presentation";
import Presentation from "@/components/presentation/Presentation";
export default async function PresentationPage({ params }) {
const resolvedParams = await params;
const slugArr = resolvedParams.slug;
// 优先从本地markdown文件获取数据
const localData = await getLocalPageData(slugArr);
if (localData.data) {
// 如果本地文件存在,直接使用本地数据
return <Presentation data={localData.data} />;
}
// 如果本地文件不存在从API获取数据
const { data, error } = await getPageData({
slug_list: slugArr,
downloadFiles: true
});
if (error || !data) {
notFound();
}
return <Presentation data={data} />;
}