fix: use current calendar slot endpoints
This commit is contained in:
@@ -228,12 +228,17 @@ export default function CalendarPage() {
|
|||||||
let response: any
|
let response: any
|
||||||
if (editingSlot) {
|
if (editingSlot) {
|
||||||
// Edit existing slot
|
// Edit existing slot
|
||||||
payload.date = selectedDate
|
if (editingSlot.is_virtual) {
|
||||||
response = await api.post(`/calendar/edit?date=${selectedDate}&slot_id=${editingSlot.slot_id}`, payload)
|
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 {
|
} else {
|
||||||
// Create new slot
|
// Create new slot
|
||||||
payload.date = selectedDate
|
payload.date = selectedDate
|
||||||
response = await api.post('/calendar/schedule', payload)
|
response = await api.post('/calendar/slots', payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for warnings in response
|
// 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
|
if (!confirm(`Cancel this ${slot.slot_type} slot at ${slot.scheduled_at}?`)) return
|
||||||
setError('')
|
setError('')
|
||||||
try {
|
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)
|
fetchSlots(selectedDate)
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
setError(err.response?.data?.detail || 'Cancel failed')
|
setError(err.response?.data?.detail || 'Cancel failed')
|
||||||
|
|||||||
Reference in New Issue
Block a user