Fix success messages.

This commit is contained in:
HenriT
2021-02-17 11:11:12 +02:00
parent e23939321d
commit 5ee9b01ee6
5 changed files with 16 additions and 14 deletions

View File

@ -71,10 +71,10 @@ export default {
this.errors.clear();
return this.$store.dispatch('bankAccounts/updateBankAccount', props)
.then((res) => {
NotificationService.success(res.message);
.then(() => {
NotificationService.success('Updated');
})
.catch(err => this.errors.set(err.response.data.errors));
.catch(err => this.errors.set(err.errors));
},
createBankAccount() {
this.loading = true;
@ -89,7 +89,7 @@ export default {
});
this.$emit('done');
})
.catch(err => this.errors.set(err.response.data.errors))
.catch(err => this.errors.set(err.errors))
.finally(() => {
this.loading = false;
});

View File

@ -119,10 +119,10 @@ export default {
this.errors.clear();
this.$store.dispatch('clients/updateClient', props)
.then((res) => {
NotificationService.success(res.message);
.then(() => {
NotificationService.success('Updated');
})
.catch(err => this.errors.set(err.response.data.errors));
.catch(err => this.errors.set(err.errors));
},
bankAccountChanged(val) {
this.updateProp({
@ -143,7 +143,7 @@ export default {
});
this.$emit('done');
})
.catch(err => this.errors.set(err.response.data.errors))
.catch(err => this.errors.set(err.errors))
.finally(() => {
this.loading = false;
});
@ -158,9 +158,9 @@ export default {
});
if (confirmed) {
this.$emit('done');
const res = await this.$store.dispatch('clients/deleteClient', clientId);
await this.$store.dispatch('clients/deleteClient', clientId);
try {
NotificationService.success(res.message);
NotificationService.success('Deleted');
} catch (err) {
NotificationService.error(err.message);
}

View File

@ -58,8 +58,8 @@ export default {
contentClass: 'bg-base dp--24',
});
if (confirmed) {
const res = await this.$store.dispatch('invoices/deleteInvoice', this.invoice);
NotificationService.success(res.message);
await this.$store.dispatch('invoices/deleteInvoice', this.invoice);
NotificationService.success('Deleted');
this.$router.push({
name: 'invoices',
});

View File

@ -30,7 +30,8 @@ class BankAccountService {
} else {
bankAccounts[index] = bankAccount;
}
return storage.setItem('bank_accounts', bankAccounts);
await storage.setItem('bank_accounts', bankAccounts);
return bankAccount;
}
}

View File

@ -124,7 +124,8 @@ class InvoiceService {
} else {
invoices[index] = invoice;
}
return storage.setItem('invoices', invoices);
await storage.setItem('invoices', invoices);
return invoice;
}
}