From d0dc8dc0fd653a3ef3cbb158dfc513be37192187 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 31 Mar 2022 13:16:53 +0200 Subject: [PATCH 1/2] the backend returns an array of errors, we display the first --- frontend/src/pages/Send.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/pages/Send.vue b/frontend/src/pages/Send.vue index 270187bec..903de6e49 100644 --- a/frontend/src/pages/Send.vue +++ b/frontend/src/pages/Send.vue @@ -134,7 +134,7 @@ export default { this.currentTransactionStep = TRANSACTION_STEPS.transactionResultSendSuccess }) .catch((err) => { - this.errorResult = err.message + this.errorResult = err[0].message this.error = true this.currentTransactionStep = TRANSACTION_STEPS.transactionResultSendError }) From aee53d17c0e9badfee8d0405094f39e109754355 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 31 Mar 2022 14:11:32 +0200 Subject: [PATCH 2/2] error message from server is toasted correctly --- frontend/src/pages/Send.spec.js | 4 +--- frontend/src/pages/Send.vue | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/frontend/src/pages/Send.spec.js b/frontend/src/pages/Send.spec.js index 9fe774e33..802fdf8a7 100644 --- a/frontend/src/pages/Send.spec.js +++ b/frontend/src/pages/Send.spec.js @@ -155,8 +155,6 @@ describe('Send', () => { }) }) - /* LINK */ - describe('transaction form link', () => { beforeEach(async () => { apolloMutationMock.mockResolvedValue({ @@ -261,7 +259,7 @@ describe('Send', () => { }) it('toasts an error message', () => { - expect(toastErrorSpy).toBeCalledWith({ message: 'OUCH!' }) + expect(toastErrorSpy).toBeCalledWith('OUCH!') }) }) }) diff --git a/frontend/src/pages/Send.vue b/frontend/src/pages/Send.vue index 903de6e49..668e24493 100644 --- a/frontend/src/pages/Send.vue +++ b/frontend/src/pages/Send.vue @@ -133,8 +133,8 @@ export default { this.transactionData = { ...EMPTY_TRANSACTION_DATA } this.currentTransactionStep = TRANSACTION_STEPS.transactionResultSendSuccess }) - .catch((err) => { - this.errorResult = err[0].message + .catch((error) => { + this.errorResult = error.message this.error = true this.currentTransactionStep = TRANSACTION_STEPS.transactionResultSendError }) @@ -153,7 +153,7 @@ export default { this.updateTransactions({}) }) .catch((error) => { - this.toastError(error) + this.toastError(error.message) }) break default: