mirror of
https://github.com/walkxcode/dashboard-icons.git
synced 2025-10-26 21:19:04 +08:00
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:
22
web/src/lib/revalidate.ts
Normal file
22
web/src/lib/revalidate.ts
Normal 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")
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user