mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-24 05:05:20 -04:00
(fix) show error message dialogue even though it is untranslatable
also prevents closing due to timeout when show() is called just after hide()
This commit is contained in:
parent
4678c325f8
commit
52f305cbf5
@ -61,6 +61,7 @@ export default Vue.extend({
|
|||||||
return {
|
return {
|
||||||
shown: false,
|
shown: false,
|
||||||
shownFull: false,
|
shownFull: false,
|
||||||
|
hideTimeout: undefined as ReturnType<typeof setTimeout> | undefined,
|
||||||
choice: false,
|
choice: false,
|
||||||
icon: undefined as string | undefined,
|
icon: undefined as string | undefined,
|
||||||
header: undefined as string | undefined,
|
header: undefined as string | undefined,
|
||||||
@ -102,6 +103,7 @@ export default Vue.extend({
|
|||||||
resolve: (value: string | string[] | undefined) => void,
|
resolve: (value: string | string[] | undefined) => void,
|
||||||
reject: () => void,
|
reject: () => void,
|
||||||
) {
|
) {
|
||||||
|
clearTimeout(this.hideTimeout);
|
||||||
this.choice = choice;
|
this.choice = choice;
|
||||||
if (typeof message === 'string') {
|
if (typeof message === 'string') {
|
||||||
message = { message };
|
message = { message };
|
||||||
@ -134,7 +136,7 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
hide() {
|
hide() {
|
||||||
this.shownFull = false;
|
this.shownFull = false;
|
||||||
setTimeout(() => {
|
this.hideTimeout = setTimeout(() => {
|
||||||
this.shown = false;
|
this.shown = false;
|
||||||
this.choice = false;
|
this.choice = false;
|
||||||
this.icon = undefined;
|
this.icon = undefined;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
</h1>
|
</h1>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<Avatar v-if="link.avatar" :user="link.avatar" dsize="1.6rem" />
|
<Avatar v-if="link.avatar" :user="link.avatar" dsize="1.6rem" />
|
||||||
<Icon v-else :v="link.icon" size="1.6" />
|
<Icon v-else :v="link.icon" :size="1.6" />
|
||||||
<br>
|
<br>
|
||||||
<span class="text-nowrap"><Spelling :text="link.text" /></span>
|
<span class="text-nowrap"><Spelling :text="link.text" /></span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -153,7 +153,15 @@ export default dark.extend({
|
|||||||
this.$axios.$post(url, data, { ...options, timeout })
|
this.$axios.$post(url, data, { ...options, timeout })
|
||||||
.then((data) => resolve(data))
|
.then((data) => resolve(data))
|
||||||
.catch(async (error) => {
|
.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'}`));
|
reject(new Error(`POST to ${url} failed: ${error.response?.data?.error || 'unknown error'}`));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user