From 8729c24e1d2bdc783e750dc1166a8ab31a716107 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Fri, 5 Jul 2024 15:53:50 +0200 Subject: [PATCH] feat: use withDefaults for Reminders (cherry picked from commit 6990be705c6d47047147dea2930196246f1e2885) --- .../components/tasks/partials/Reminders.vue | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/tasks/partials/Reminders.vue b/frontend/src/components/tasks/partials/Reminders.vue index bba2a0ad1..e3fd23842 100644 --- a/frontend/src/components/tasks/partials/Reminders.vue +++ b/frontend/src/components/tasks/partials/Reminders.vue @@ -3,7 +3,7 @@
() +}>(), { + disabled: false, +}) -const emit = defineEmits(['update:modelValue']) +const emit = defineEmits<{ + 'update:modelValue': [ITask] +}>() const reminders = ref([]) +const now = useNow({interval: 1000}) + watch( - () => modelValue.reminders, + () => props.modelValue.reminders, (newVal) => { reminders.value = newVal }, @@ -62,19 +66,19 @@ watch( ) const defaultRelativeTo = computed(() => { - if (typeof modelValue === 'undefined') { + if (typeof props.modelValue === 'undefined') { return null } - if (modelValue?.dueDate) { + if (props.modelValue?.dueDate) { return REMINDER_PERIOD_RELATIVE_TO_TYPES.DUEDATE } - if (modelValue.dueDate === null && modelValue.startDate !== null) { + if (props.modelValue.dueDate === null && props.modelValue.startDate !== null) { return REMINDER_PERIOD_RELATIVE_TO_TYPES.STARTDATE } - if (modelValue.dueDate === null && modelValue.startDate === null && modelValue.endDate !== null) { + if (props.modelValue.dueDate === null && props.modelValue.startDate === null && props.modelValue.endDate !== null) { return REMINDER_PERIOD_RELATIVE_TO_TYPES.ENDDATE } @@ -83,7 +87,7 @@ const defaultRelativeTo = computed(() => { function updateData() { emit('update:modelValue', { - ...modelValue, + ...props.modelValue, reminders: reminders.value, }) }