feat(web): add cache revalidation utilities

Add server-side utilities for cache revalidation using Next.js revalidatePath and revalidateTag. Provides functions to revalidate community page and all submission-related pages after data changes
This commit is contained in:
Thomas Camlong
2025-10-01 18:23:05 +02:00
parent b277ceb9a0
commit 77e55e750f

22
web/src/lib/revalidate.ts Normal file
View File

@@ -0,0 +1,22 @@
"use server"
import { revalidatePath, revalidateTag } from "next/cache"
/**
* Revalidate the community page cache
* Can be called from server actions after submission approval/rejection
*/
export async function revalidateCommunityPage() {
revalidatePath("/community")
revalidateTag("community-gallery")
}
/**
* Revalidate all submission-related caches
*/
export async function revalidateSubmissions() {
revalidateTag("community-gallery")
revalidatePath("/community")
revalidatePath("/dashboard")
}