diff --git a/components/DialogueBox.vue b/components/DialogueBox.vue index 311f66b70..2d897c593 100644 --- a/components/DialogueBox.vue +++ b/components/DialogueBox.vue @@ -61,6 +61,7 @@ export default Vue.extend({ return { shown: false, shownFull: false, + hideTimeout: undefined as ReturnType | undefined, choice: false, icon: undefined as string | undefined, header: undefined as string | undefined, @@ -102,6 +103,7 @@ export default Vue.extend({ resolve: (value: string | string[] | undefined) => void, reject: () => void, ) { + clearTimeout(this.hideTimeout); this.choice = choice; if (typeof message === 'string') { message = { message }; @@ -134,7 +136,7 @@ export default Vue.extend({ }, hide() { this.shownFull = false; - setTimeout(() => { + this.hideTimeout = setTimeout(() => { this.shown = false; this.choice = false; this.icon = undefined; diff --git a/components/Header.vue b/components/Header.vue index 696ae816d..ec83783a2 100644 --- a/components/Header.vue +++ b/components/Header.vue @@ -15,7 +15,7 @@ diff --git a/layouts/default.vue b/layouts/default.vue index 37138d0ba..0dab324b3 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -153,7 +153,15 @@ export default dark.extend({ this.$axios.$post(url, data, { ...options, timeout }) .then((data) => resolve(data)) .catch(async (error) => { - await this.$alert(this.$t(error.response?.data?.error || 'error.generic'), 'danger'); + let errorMessage = this.$t('error.generic'); + if (typeof error.response?.data?.error === 'string') { + errorMessage = this.$t(error.response?.data?.error); + // in case no translatable key was provided + if (errorMessage === undefined) { + errorMessage = error.response?.data?.error; + } + } + await this.$alert(errorMessage, 'danger'); reject(new Error(`POST to ${url} failed: ${error.response?.data?.error || 'unknown error'}`)); }); });