From 36b4c6cce7f599cad8d33e18fb2b1643f9cbf7b3 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 22 Mar 2022 09:01:09 +0100 Subject: [PATCH 1/9] update-balance if link succesfully generated --- frontend/src/pages/Send.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/pages/Send.vue b/frontend/src/pages/Send.vue index 89eb1bbe2..bce9a6069 100644 --- a/frontend/src/pages/Send.vue +++ b/frontend/src/pages/Send.vue @@ -143,6 +143,10 @@ export default { .then((result) => { this.code = result.data.createTransactionLink.code this.currentTransactionStep = TRANSACTION_STEPS.transactionResultLink + this.$emit( + 'update-balance', + this.transactionData.amount + this.transactionData.amount * 0.028, + ) }) .catch((error) => { this.toastError(error) From 0a3f80ddc9ee883edf24557030f8cfb2ba1e5b4b Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 22 Mar 2022 17:53:51 +0100 Subject: [PATCH 2/9] add default properties to restore data when transaction is canceled in confirmation step --- frontend/src/components/GddSend/TransactionForm.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/GddSend/TransactionForm.vue b/frontend/src/components/GddSend/TransactionForm.vue index ec4aff4d3..c1acf9925 100644 --- a/frontend/src/components/GddSend/TransactionForm.vue +++ b/frontend/src/components/GddSend/TransactionForm.vue @@ -160,15 +160,18 @@ export default { }, props: { balance: { type: Number, default: 0 }, + email: { type: String, default: '' }, + amount: { type: Number, default: 0 }, + memo: { type: String, default: '' }, }, data() { return { amountFocused: false, emailFocused: false, form: { - email: '', - amount: '', - memo: '', + email: this.email, + amount: this.amount ? String(this.amount) : '', + memo: this.memo, amountValue: 0.0, }, selected: SEND_TYPES.send, From e08e1b7ea8618d675aea2ae23b5ff31616cdecf8 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 22 Mar 2022 17:54:55 +0100 Subject: [PATCH 3/9] remove update balance method and event. We want to have the data always from the backend and do no calculation in the frontend --- frontend/src/layouts/DashboardLayout_gdd.spec.js | 8 -------- frontend/src/layouts/DashboardLayout_gdd.vue | 4 ---- 2 files changed, 12 deletions(-) diff --git a/frontend/src/layouts/DashboardLayout_gdd.spec.js b/frontend/src/layouts/DashboardLayout_gdd.spec.js index 2a8b7bf42..fd45b9f05 100644 --- a/frontend/src/layouts/DashboardLayout_gdd.spec.js +++ b/frontend/src/layouts/DashboardLayout_gdd.spec.js @@ -140,14 +140,6 @@ describe('DashboardLayoutGdd', () => { }) }) - describe('update balance', () => { - it('updates the amount correctelly', async () => { - await wrapper.findComponent({ ref: 'router-view' }).vm.$emit('update-balance', 5) - await flushPromises() - expect(wrapper.vm.balance).toBe(-5) - }) - }) - describe('update transactions', () => { beforeEach(async () => { apolloMock.mockResolvedValue({ diff --git a/frontend/src/layouts/DashboardLayout_gdd.vue b/frontend/src/layouts/DashboardLayout_gdd.vue index 9c7cf9c0c..a2a76d88c 100755 --- a/frontend/src/layouts/DashboardLayout_gdd.vue +++ b/frontend/src/layouts/DashboardLayout_gdd.vue @@ -27,7 +27,6 @@ :transactionLinkCount="transactionLinkCount" :pending="pending" :decayStartBlock="decayStartBlock" - @update-balance="updateBalance" @update-transactions="updateTransactions" > @@ -112,9 +111,6 @@ export default { // what to do when loading balance fails? }) }, - updateBalance(ammount) { - this.balance -= ammount - }, admin() { window.location.assign(CONFIG.ADMIN_AUTH_URL.replace('{token}', this.$store.state.token)) this.$store.dispatch('logout') // logout without redirect From 8c8d06d87c5c89f571ef65450ac54c6545b6fb9a Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 22 Mar 2022 17:56:34 +0100 Subject: [PATCH 4/9] bind the transaction data to the transaction form to allow data restoration after canceling transaction confirmation, use always update transaction to update balance --- frontend/src/pages/Send.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/src/pages/Send.vue b/frontend/src/pages/Send.vue index bce9a6069..38f232fda 100644 --- a/frontend/src/pages/Send.vue +++ b/frontend/src/pages/Send.vue @@ -3,7 +3,11 @@