refactor: enhance cache invalidation logic across banking API routes and components for improved data consistency and performance

This commit is contained in:
Julien Froidefond
2025-12-08 14:04:12 +01:00
parent 53bae084c4
commit 8d947ad70f
14 changed files with 412 additions and 200 deletions

View File

@@ -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(