HarborForge.Frontend: proposal/essential tests on current branch head #11

Merged
hzhang merged 13 commits from pr/dev-2026-03-29-frontend-tests-20260405 into main 2026-04-05 22:07:47 +00:00
Showing only changes of commit ea841d0d39 - Show all commits

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')