fix: error 400

This commit is contained in:
Carlos Satorres 2025-02-28 15:31:01 +01:00
parent 56e71b01d3
commit 38658b6df9
1 changed files with 4 additions and 4 deletions

View File

@ -79,7 +79,7 @@ const editEvent = async (event) => {
}; };
const { data } = await axios.patch( const { data } = await axios.patch(
`Workers/${route.params.id}/updateAbsence`, `Workers/${route.params.id}/updateAbsence`,
params params,
); );
if (data) emit('refresh'); if (data) emit('refresh');
@ -94,7 +94,7 @@ const deleteEvent = async (event, date) => {
if (data) emit('onDeletedEvent', date.getTime()); if (data) emit('onDeletedEvent', date.getTime());
}; };
const handleDateSelected = (date) => { const handleDateSelected = async (date) => {
if (!props.absenceType) { if (!props.absenceType) {
notify(t('Choose an absence type from the right menu'), 'warning'); notify(t('Choose an absence type from the right menu'), 'warning');
return; return;
@ -108,14 +108,14 @@ const handleDateSelected = (date) => {
if (!event) createEvent(_date); if (!event) createEvent(_date);
}; };
const handleEventSelected = (event, { year, month, day }) => { const handleEventSelected = async (event, { year, month, day }) => {
if (!props.absenceType) { if (!props.absenceType) {
notify(t('Choose an absence type from the right menu'), 'warning'); notify(t('Choose an absence type from the right menu'), 'warning');
return; return;
} }
const date = new Date(year, month - 1, day); const date = new Date(year, month - 1, day);
if (!event?.absenceId) createEvent(date); if (!event?.absenceId) await createEvent(date);
else if (event.type == props.absenceType.code) deleteEvent(event, date); else if (event.type == props.absenceType.code) deleteEvent(event, date);
else editEvent(event); else editEvent(event);
}; };