From 136425a0ea142b2310f0d12219552333722683cb Mon Sep 17 00:00:00 2001 From: ngc2207 Date: Tue, 12 Nov 2024 18:06:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9C=A8=E5=88=A0=E9=99=A4=E5=92=8C?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=B8=AD=E6=B7=BB=E5=8A=A0=E8=B7=AF=E5=BE=84=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E9=AA=8C=E8=AF=81=EF=BC=8C=E9=81=BF=E5=85=8D=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=BC=93=E5=AD=98=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/actions/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/actions/index.ts b/src/actions/index.ts index 4b4d314..25a5005 100644 --- a/src/actions/index.ts +++ b/src/actions/index.ts @@ -1,6 +1,7 @@ "use server"; import { db } from "@/db"; +import { revalidatePath } from "next/cache"; import { redirect } from "next/navigation"; export async function editSnippet(id: number, code: string) { @@ -15,6 +16,7 @@ export async function editSnippet(id: number, code: string) { export async function deleteSnippet(id: number) { await db.snippet.delete({ where: { id } }); + revalidatePath("/"); redirect("/"); } @@ -54,6 +56,7 @@ export async function createSnippet( }; } } + revalidatePath("/"); // Redirect the user back to the root route redirect("/"); }