diff --git a/frontend/app/admin/appointments/page.tsx b/frontend/app/admin/appointments/page.tsx index 475fb85..5ce2390 100644 --- a/frontend/app/admin/appointments/page.tsx +++ b/frontend/app/admin/appointments/page.tsx @@ -202,11 +202,7 @@ export default function AdminAppointmentsPage() { await fetchAppointments(); setConfirmCancelId(null); } catch (err) { - if (err instanceof Error) { - setError(err.message); - } else { - setError("Failed to cancel appointment"); - } + setError(err instanceof Error ? err.message : "Failed to cancel appointment"); } finally { setCancellingId(null); } diff --git a/frontend/app/appointments/page.tsx b/frontend/app/appointments/page.tsx index ea13973..aa2f495 100644 --- a/frontend/app/appointments/page.tsx +++ b/frontend/app/appointments/page.tsx @@ -194,11 +194,7 @@ export default function AppointmentsPage() { await fetchAppointments(); setConfirmCancelId(null); } catch (err) { - if (err instanceof Error) { - setError(err.message); - } else { - setError("Failed to cancel appointment"); - } + setError(err instanceof Error ? err.message : "Failed to cancel appointment"); } finally { setCancellingId(null); } diff --git a/frontend/app/booking/page.tsx b/frontend/app/booking/page.tsx index 13811a4..a387dce 100644 --- a/frontend/app/booking/page.tsx +++ b/frontend/app/booking/page.tsx @@ -302,11 +302,7 @@ export default function BookingPage() { await fetchSlots(selectedDate); } } catch (err) { - if (err instanceof Error) { - setError(err.message); - } else { - setError("Failed to book appointment"); - } + setError(err instanceof Error ? err.message : "Failed to book appointment"); } finally { setIsBooking(false); }