fix: sanitize API error text display and add time_blockers tests
Add extractErrorMessage helper for JSON error body parsing and apply sanitizeText across all toast displays. Add time_blockers test coverage for new holiday placeholder cleanup and overlapping scenarios.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { SvelteDate, SvelteSet } from 'svelte/reactivity';
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { extractErrorMessage } from '$lib/utils/toast-safe';
|
||||
import { apiFetch } from '$lib/utils/api';
|
||||
import { CalendarDate, getLocalTimeZone, type DateValue } from '@internationalized/date';
|
||||
import { Checkbox } from '$lib/components/ui/checkbox';
|
||||
@@ -323,7 +324,7 @@
|
||||
onSaved?.();
|
||||
} else {
|
||||
const text = await response.text();
|
||||
toast.error('Failed to reschedule: ' + text, { id: loadingToast });
|
||||
toast.error('Failed to reschedule: ' + extractErrorMessage(text), { id: loadingToast });
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error rescheduling booking:', err);
|
||||
|
||||
Reference in New Issue
Block a user