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("/"); }