refactor: enhance cache invalidation logic across banking API routes and components for improved data consistency and performance
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { transactionService } from "@/services/transaction.service";
|
||||
import { requireAuth } from "@/lib/auth-utils";
|
||||
|
||||
@@ -8,7 +9,17 @@ export async function POST() {
|
||||
|
||||
try {
|
||||
const result = await transactionService.deduplicate();
|
||||
return NextResponse.json(result);
|
||||
|
||||
// Revalider le cache des pages
|
||||
revalidatePath("/transactions", "page");
|
||||
revalidatePath("/statistics", "page");
|
||||
revalidatePath("/dashboard", "page");
|
||||
|
||||
return NextResponse.json(result, {
|
||||
headers: {
|
||||
"Cache-Control": "no-store",
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error deduplicating transactions:", error);
|
||||
return NextResponse.json(
|
||||
|
||||
Reference in New Issue
Block a user