Skip to content

Commit

Permalink
fix(calendarPicker): undefined calendar
Browse files Browse the repository at this point in the history
Signed-off-by: Hamza Mahjoubi <[email protected]>
  • Loading branch information
hamza221 committed Nov 6, 2024
1 parent aa30c8f commit 94fc5d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/components/AppointmentConfigModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

<template>
<Modal size="large"
:name="formTitle"
@close="$emit('close')">
<!-- Wait for the config to become available before rendering the form. -->
<div v-if="editing" class="appointment-config-modal">
Expand All @@ -13,7 +14,6 @@
:config="editing"
@close="$emit('close')" />
<template v-else>
<h2>{{ formTitle }}</h2>
<div class="appointment-config-modal__form">
<fieldset>
<TextInput class="appointment-config-modal__form__row"
Expand Down Expand Up @@ -198,6 +198,9 @@ export default {
...mapState(useCalendarsStore, ['ownSortedCalendars']),
...mapStores(useAppointmentConfigsStore, useCalendarsStore, useSettingsStore),
formTitle() {
if (this.showConfirmation) {
return this.$t('calendar', 'Appointment schedule saved')
}

Check warning on line 203 in src/components/AppointmentConfigModal.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppointmentConfigModal.vue#L203

Added line #L203 was not covered by tests
if (this.isNew) {
return this.$t('calendar', 'Create appointment schedule')
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/Shared/CalendarPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ export default {
},
valueIds() {
if (Array.isArray(this.value)) {
return this.value.map(({ id }) => id)
// filter out falsy values (e.g. null, undefined)

Check warning on line 89 in src/components/Shared/CalendarPicker.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Shared/CalendarPicker.vue#L89

Added line #L89 was not covered by tests
return this.value.filter(v => v).map(({ id }) => id)
}
return this.value.id
Expand Down

0 comments on commit 94fc5d1

Please sign in to comment.