change some error message dialog to error message toast

This commit is contained in:
MaysWind
2020-11-24 00:48:53 +08:00
parent 645bd07d72
commit 48b60fec30
9 changed files with 71 additions and 61 deletions
+15 -15
View File
@@ -175,7 +175,7 @@ export default {
const data = response.data;
if (!data || !data.success || !data.result || !self.$utilities.isBoolean(data.result.enable)) {
self.$alert('Unable to get current two factor authentication status', () => {
self.$toast('Unable to get current two factor authentication status', () => {
router.back();
});
return;
@@ -187,11 +187,11 @@ export default {
self.$logger.error('failed to get 2fa status', error);
if (error.response && error.response.data && error.response.data.errorMessage) {
self.$alert({ error: error.response.data }, () => {
self.$toast({ error: error.response.data }, () => {
router.back();
});
} else if (!error.processed) {
self.$alert('Unable to get current two factor authentication status', () => {
self.$toast('Unable to get current two factor authentication status', () => {
router.back();
});
}
@@ -213,7 +213,7 @@ export default {
const data = response.data;
if (!data || !data.success || !data.result || !data.result.qrcode || !data.result.secret) {
self.$alert('Unable to enable two factor authentication');
self.$toast('Unable to enable two factor authentication');
return;
}
@@ -228,9 +228,9 @@ export default {
self.$hideLoading();
if (error.response && error.response.data && error.response.data.errorMessage) {
self.$alert({error: error.response.data});
self.$toast({error: error.response.data});
} else if (!error.processed) {
self.$alert('Unable to enable two factor authentication');
self.$toast('Unable to enable two factor authentication');
}
});
},
@@ -249,7 +249,7 @@ export default {
const data = response.data;
if (!data || !data.success || !data.result || !data.result.token) {
self.$alert('Unable to enable two factor authentication');
self.$toast('Unable to enable two factor authentication');
return;
}
@@ -272,9 +272,9 @@ export default {
self.$hideLoading();
if (error.response && error.response.data && error.response.data.errorMessage) {
self.$alert({error: error.response.data});
self.$toast({error: error.response.data});
} else if (!error.processed) {
self.$alert('Unable to enable two factor authentication');
self.$toast('Unable to enable two factor authentication');
}
});
},
@@ -298,7 +298,7 @@ export default {
const data = response.data;
if (!data || !data.success || !data.result) {
self.$alert('Unable to disable two factor authentication');
self.$toast('Unable to disable two factor authentication');
return;
}
@@ -312,9 +312,9 @@ export default {
self.$hideLoading();
if (error.response && error.response.data && error.response.data.errorMessage) {
self.$alert({error: error.response.data});
self.$toast({error: error.response.data});
} else if (!error.processed) {
self.$alert('Unable to disable two factor authentication');
self.$toast('Unable to disable two factor authentication');
}
});
},
@@ -338,7 +338,7 @@ export default {
const data = response.data;
if (!data || !data.success || !data.result || !data.result.recoveryCodes || !data.result.recoveryCodes.length) {
self.$alert('Unable to regenerate two factor authentication backup codes');
self.$toast('Unable to regenerate two factor authentication backup codes');
return;
}
@@ -353,9 +353,9 @@ export default {
self.$hideLoading();
if (error.response && error.response.data && error.response.data.errorMessage) {
self.$alert({error: error.response.data});
self.$toast({error: error.response.data});
} else if (!error.processed) {
self.$alert('Unable to regenerate two factor authentication backup codes');
self.$toast('Unable to regenerate two factor authentication backup codes');
}
});
},