fix(appointments): stay on the same day after edit/create
AppointmentsPage now reads an optional ?date=YYYY-MM-DD query param as its initial selected date. AppointmentEditPage and AppointmentCreatePage navigate back to /admin/appointments?date=<the appointment's day> on save (and the edit page's back link carries the date too), so the user returns to the day they were viewing instead of today. Test: AppointmentsPage honors ?date= and fetches that day. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -116,7 +116,8 @@ export default function AppointmentCreatePage() {
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: ['appointments'] });
|
||||
toast.success('نوبت با موفقیت ثبت شد');
|
||||
navigate('/admin/appointments');
|
||||
// به همان روزِ نوبت برگرد، نه امروز.
|
||||
navigate(`/admin/appointments?date=${date}`);
|
||||
},
|
||||
onError: (e: any) => toast.error(e.message || 'خطا در ثبت نوبت'),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user