mirror of
https://litchi.icu/ngc2207/judge4c-demo.git
synced 2025-05-18 10:17:13 +00:00
feat: 在编辑代码片段功能中添加路径重新验证,并实现静态参数生成
This commit is contained in:
parent
136425a0ea
commit
4d64a3464f
@ -10,6 +10,7 @@ export async function editSnippet(id: number, code: string) {
|
||||
data: { code },
|
||||
});
|
||||
|
||||
revalidatePath(`/snippets/${id}`);
|
||||
redirect(`/snippets/${id}`);
|
||||
}
|
||||
|
||||
|
@ -47,3 +47,13 @@ export default async function SnippetShowPage(props: SnippetShowPageProps) {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const snippets = await db.snippet.findMany();
|
||||
|
||||
return snippets.map((snippet) => {
|
||||
return {
|
||||
id: snippet.id.toString(),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user