mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-14 15:07:33 +08:00
change some error message dialog to error message toast
This commit is contained in:
@@ -175,7 +175,7 @@ export default {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result || !data.result.token) {
|
||||
self.$alert('Unable to login');
|
||||
self.$toast('Unable to login');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -207,9 +207,9 @@ export default {
|
||||
}
|
||||
|
||||
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 login');
|
||||
self.$toast('Unable to login');
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -258,7 +258,7 @@ export default {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result || !data.result.token) {
|
||||
self.$alert('Unable to verify');
|
||||
self.$toast('Unable to verify');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -281,9 +281,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 verify');
|
||||
self.$toast('Unable to verify');
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -180,7 +180,7 @@ export default {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
self.$alert('Unable to logout');
|
||||
self.$toast('Unable to logout');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -201,9 +201,9 @@ export default {
|
||||
}
|
||||
|
||||
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 logout');
|
||||
self.$toast('Unable to logout');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -153,7 +153,7 @@ export default {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
self.$alert('Unable to sign up');
|
||||
self.$toast('Unable to sign up');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -178,9 +178,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 sign up');
|
||||
self.$toast('Unable to sign up');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ export default {
|
||||
router.refreshPage();
|
||||
} catch (ex) {
|
||||
this.$logger.error('failed to unlock by pin code', ex);
|
||||
this.$alert('PIN code is wrong');
|
||||
this.$toast('PIN code is wrong');
|
||||
}
|
||||
},
|
||||
relogin() {
|
||||
|
||||
@@ -357,7 +357,7 @@ export default {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
self.$alert('Unable to get account', () => {
|
||||
self.$toast('Unable to get account', () => {
|
||||
router.back();
|
||||
});
|
||||
return;
|
||||
@@ -397,11 +397,11 @@ export default {
|
||||
self.$logger.error('failed to load account info', 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 account', () => {
|
||||
self.$toast('Unable to get account', () => {
|
||||
router.back();
|
||||
});
|
||||
}
|
||||
@@ -473,7 +473,17 @@ export default {
|
||||
const self = this;
|
||||
const router = self.$f7router;
|
||||
|
||||
let problemMessage = self.inputEmptyProblemMessage;
|
||||
let problemMessage = self.getInputEmptyProblemMessage(self.account, false);
|
||||
|
||||
if (!problemMessage && self.account.type === self.$constants.account.allAccountTypes.MultiSubAccounts.toString()) {
|
||||
for (let i = 0; i < self.subAccounts.length; i++) {
|
||||
problemMessage = self.getInputEmptyProblemMessage(self.subAccounts[i], true);
|
||||
|
||||
if (problemMessage) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (problemMessage) {
|
||||
self.$alert(problemMessage);
|
||||
@@ -535,9 +545,9 @@ export default {
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
if (!self.editAccountId) {
|
||||
self.$alert('Unable to add account');
|
||||
self.$toast('Unable to add account');
|
||||
} else {
|
||||
self.$alert('Unable to save account');
|
||||
self.$toast('Unable to save account');
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -556,12 +566,12 @@ 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) {
|
||||
if (!self.editAccountId) {
|
||||
self.$alert('Unable to add account');
|
||||
self.$toast('Unable to add account');
|
||||
} else {
|
||||
self.$alert('Unable to save account');
|
||||
self.$toast('Unable to save account');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -308,7 +308,7 @@ export default {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
self.$alert('Unable to get account list', () => {
|
||||
self.$toast('Unable to get account list', () => {
|
||||
router.back();
|
||||
});
|
||||
return;
|
||||
@@ -320,11 +320,11 @@ export default {
|
||||
self.$logger.error('failed to load account list', 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 account list', () => {
|
||||
self.$toast('Unable to get account list', () => {
|
||||
router.back();
|
||||
});
|
||||
}
|
||||
@@ -485,7 +485,7 @@ export default {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
self.$alert('Unable to move account');
|
||||
self.$toast('Unable to move account');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -499,9 +499,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 move account');
|
||||
self.$toast('Unable to move account');
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -574,7 +574,7 @@ export default {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
self.$alert('Unable to delete this account');
|
||||
self.$toast('Unable to delete this account');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -592,9 +592,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 delete this account');
|
||||
self.$toast('Unable to delete this account');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ export default {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
self.$alert('Unable to get session list', () => {
|
||||
self.$toast('Unable to get session list', () => {
|
||||
router.back();
|
||||
});
|
||||
return;
|
||||
@@ -72,11 +72,11 @@ export default {
|
||||
self.$logger.error('failed to load token list', 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 session list', () => {
|
||||
self.$toast('Unable to get session list', () => {
|
||||
router.back();
|
||||
});
|
||||
}
|
||||
@@ -124,7 +124,7 @@ export default {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
self.$alert('Unable to logout from this session');
|
||||
self.$toast('Unable to logout from this session');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -141,9 +141,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 logout from this session');
|
||||
self.$toast('Unable to logout from this session');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -163,7 +163,7 @@ export default {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
self.$alert('Unable to logout all other sessions');
|
||||
self.$toast('Unable to logout all other sessions');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -180,9 +180,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 logout all other sessions');
|
||||
self.$toast('Unable to logout all other sessions');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -174,7 +174,7 @@ export default {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
self.$alert('Unable to get user profile', () => {
|
||||
self.$toast('Unable to get user profile', () => {
|
||||
router.back();
|
||||
});
|
||||
return;
|
||||
@@ -192,11 +192,11 @@ export default {
|
||||
self.$logger.error('failed to get user profile', 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 user profile', () => {
|
||||
self.$toast('Unable to get user profile', () => {
|
||||
router.back();
|
||||
});
|
||||
}
|
||||
@@ -238,7 +238,7 @@ export default {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
self.$alert('Unable to update user profile');
|
||||
self.$toast('Unable to update user profile');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -260,9 +260,9 @@ export default {
|
||||
self.currentPassword = '';
|
||||
|
||||
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 update user profile');
|
||||
self.$toast('Unable to update user profile');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user