Fix: Refresh page after updating order tracking details
Add revalidatePath() call to updateOrderTracking server action so the admin order page refreshes after updating tracking info. This ensures the displayed data matches the database immediately.
This commit is contained in:
@@ -77,7 +77,8 @@
|
|||||||
"Bash(git commit -m 'Fix: Update order status to PAID on checkout success page *)",
|
"Bash(git commit -m 'Fix: Update order status to PAID on checkout success page *)",
|
||||||
"Bash(git commit -m 'Improve: Cart clearing on success page with better state management *)",
|
"Bash(git commit -m 'Improve: Cart clearing on success page with better state management *)",
|
||||||
"Bash(git commit -m 'Feature: Add order tracking and shipping status updates *)",
|
"Bash(git commit -m 'Feature: Add order tracking and shipping status updates *)",
|
||||||
"Bash(git commit -m 'Feature: Royal Mail tracking integration \\(hybrid approach\\) *)"
|
"Bash(git commit -m 'Feature: Royal Mail tracking integration \\(hybrid approach\\) *)",
|
||||||
|
"Bash(git commit -m 'Fix: Refresh page after updating order tracking details *)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
'use server';
|
'use server';
|
||||||
|
|
||||||
import { redirect } from 'next/navigation';
|
import { redirect, revalidatePath } from 'next/navigation';
|
||||||
import { prisma } from '@/lib/prisma';
|
import { prisma } from '@/lib/prisma';
|
||||||
|
|
||||||
const AUTO_ARCHIVE_DAYS = 30;
|
const AUTO_ARCHIVE_DAYS = 30;
|
||||||
@@ -55,5 +55,8 @@ export async function updateOrderTracking(formData: FormData) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Revalidate the page to show updated data
|
||||||
|
revalidatePath(`/admin/orders/${id}`);
|
||||||
|
|
||||||
// TODO: Send email notification to customer when status changes
|
// TODO: Send email notification to customer when status changes
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user