fix: use current calendar slot endpoints

This commit is contained in:
2026-04-04 12:09:43 +00:00
parent a431711ff0
commit ea841d0d39

View File

@@ -228,12 +228,17 @@ export default function CalendarPage() {
let response: any
if (editingSlot) {
// Edit existing slot
payload.date = selectedDate
response = await api.post(`/calendar/edit?date=${selectedDate}&slot_id=${editingSlot.slot_id}`, payload)
if (editingSlot.is_virtual) {
response = await api.patch(`/calendar/slots/virtual/${editingSlot.slot_id}`, payload)
} else if (editingSlot.slot_id) {
response = await api.patch(`/calendar/slots/${editingSlot.slot_id}`, payload)
} else {
throw new Error('Missing slot identifier for edit')
}
} else {
// Create new slot
payload.date = selectedDate
response = await api.post('/calendar/schedule', payload)
response = await api.post('/calendar/slots', payload)
}
// Check for warnings in response
@@ -260,7 +265,13 @@ export default function CalendarPage() {
if (!confirm(`Cancel this ${slot.slot_type} slot at ${slot.scheduled_at}?`)) return
setError('')
try {
await api.post(`/calendar/cancel?date=${selectedDate}&slot_id=${slot.slot_id}`)
if (slot.is_virtual) {
await api.post(`/calendar/slots/virtual/${slot.slot_id}/cancel`)
} else if (slot.slot_id) {
await api.post(`/calendar/slots/${slot.slot_id}/cancel`)
} else {
throw new Error('Missing slot identifier for cancel')
}
fetchSlots(selectedDate)
} catch (err: any) {
setError(err.response?.data?.detail || 'Cancel failed')