0
0
Fork 0

fix: fixed delete event and dated value when excluding a day

This commit is contained in:
Jon Elias 2024-11-27 08:02:18 +01:00
parent e10e0d01e6
commit 07ba02aec8
1 changed files with 6 additions and 6 deletions

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, computed, onMounted } from 'vue';
import { ref, computed, onMounted, reactive } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
@ -43,7 +43,7 @@ const { t } = useI18n();
const { openConfirmationModal } = useVnConfirm();
const isNew = computed(() => props.isNewMode);
const dated = ref(props.date);
const dated = reactive(props.date);
const tickedNodes = ref();
const _excludeType = ref('all');
@ -68,12 +68,11 @@ const exclusionGeoCreate = async () => {
const exclusionCreate = async () => {
if (isNew.value)
await axios.post(`Zones/${route.params.id}/exclusions`, [{ dated: dated.value }]);
await axios.post(`Zones/${route.params.id}/exclusions`, [{ dated: dated }]);
else
await axios.post(`Zones/${route.params.id}/exclusions`, {
dated: dated.value,
dated: dated,
});
await refetchEvents();
};
@ -84,7 +83,8 @@ const onSubmit = async () => {
const deleteEvent = async () => {
if (!props.event) return;
await axios.delete(`Zones/${route.params.id}/exclusions`);
const exclusionId = props.event?.zoneExclusionFk || props.event?.id;
await axios.delete(`Zones/${route.params.id}/exclusions/${exclusionId}`);
await refetchEvents();
};