Skip to content

Commit

Permalink
Display error dialog to user when creating calendar for new list fails
Browse files Browse the repository at this point in the history
Signed-off-by: Ripsnapper <5287573+Ripsnapper@users.noreply.github.com>
  • Loading branch information
Ripsnapper committed Jun 22, 2024
1 parent 31ce814 commit 2c105bc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/views/AppNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ import Colorpicker from '../components/AppNavigation/Colorpicker.vue'
import AppNavigationSettings from '../components/AppNavigation/AppNavigationSettings.vue'
import Trashbin from '../components/AppNavigation/Trashbin.vue'
import { showError } from '@nextcloud/dialogs'
import { translate as t } from '@nextcloud/l10n'
import NcAppNavigation from '@nextcloud/vue/dist/Components/NcAppNavigation.js'
import NcAppNavigationItem from '@nextcloud/vue/dist/Components/NcAppNavigationItem.js'
Expand Down Expand Up @@ -394,11 +395,17 @@ export default {
if (!this.isNameAllowed(this.newCalendarName).allowed) {
return
}
const { id: calendarId } = await this.appendCalendar({ displayName: this.newCalendarName, color: this.selectedColor })
if (calendarId) {
await this.$router.push({ name: 'calendars', params: { calendarId } })
try {
const { id: calendarId } = await this.appendCalendar({ displayName: this.newCalendarName, color: this.selectedColor })
if (calendarId) {
await this.$router.push({ name: 'calendars', params: { calendarId } })
}
} catch (error) {
console.debug(error)
showError(t('tasks', 'An error occurred, unable to create the list.'))
} finally {
this.creating = false
}
this.creating = false
},
checkName(event) {
const check = this.isNameAllowed(this.newCalendarName)
Expand Down

0 comments on commit 2c105bc

Please sign in to comment.