mirror of
https://litchi.icu/ngc2207/judge4c-demo.git
synced 2025-05-18 17:16:35 +00:00
26 lines
520 B
TypeScript
26 lines
520 B
TypeScript
import { db } from "@/db";
|
|
import { notFound } from "next/navigation";
|
|
|
|
interface SnippetShowPageProps {
|
|
params: Promise<{
|
|
id: string;
|
|
}>;
|
|
}
|
|
|
|
export default async function SnippetShowPage(props: SnippetShowPageProps) {
|
|
await new Promise((r) => setTimeout(r, 2000));
|
|
|
|
const params = await props.params;
|
|
const snippet = await db.snippet.findFirst({
|
|
where: {
|
|
id: parseInt(params.id),
|
|
},
|
|
});
|
|
|
|
if (!snippet) {
|
|
return notFound();
|
|
}
|
|
|
|
return <div>Show a snippet: {snippet.title}</div>;
|
|
}
|