allow user choosing whether add preset categories in registration page

This commit is contained in:
MaysWind
2021-01-07 17:29:24 +08:00
parent d073550aa7
commit aec708cdd3
7 changed files with 266 additions and 30 deletions
+5 -15
View File
@@ -159,30 +159,20 @@ export default {
}
}
self.$services.addTransactionCategoryBatch({
self.$store.dispatch('addTransactionCategoryBatch', {
categories: categories
}).then(response => {
}).then(() => {
self.submitting = false;
self.$hideLoading();
const data = response.data;
if (!data || !data.success || !data.result) {
self.$toast('Unable to add category');
return;
}
self.$toast('You have added default categories');
self.$toast('You have added preset categories');
router.back();
}).catch(error => {
self.$logger.error('failed to save default categories', error);
self.submitting = false;
self.$hideLoading();
if (error.response && error.response.data && error.response.data.errorMessage) {
self.$toast({ error: error.response.data });
} else if (!error.processed) {
self.$toast('Unable to add category');
if (!error.processed) {
self.$toast(error.message || error);
}
});
}