From c075e4a0df10beb6805fec3755189b63d7de3ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=BE=D0=BC=D0=B0?= Date: Thu, 5 Apr 2018 12:50:42 +0800 Subject: [PATCH 1/4] update balances on new transfer operation --- src/modules/operations.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/operations.js b/src/modules/operations.js index 382f5c8..4df6b62 100644 --- a/src/modules/operations.js +++ b/src/modules/operations.js @@ -51,6 +51,10 @@ const actions = { userId }); if (!parsedData) return; + if (parsedData.operations[0].type === 'transfer') { + // update current user balances + store.dispatch('account/fetchCurrentUser', null, { root: true }); + } store.dispatch('assets/fetchAssets', { assets: parsedData.assetsIds }, { root: true }); commit(types.ADD_USER_OPERATION, { operation: parsedData.operations[0] From 41a1b854c7eddf1cb87c79947f5d5db8b0c749f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=BE=D0=BC=D0=B0?= Date: Thu, 5 Apr 2018 13:17:18 +0800 Subject: [PATCH 2/4] + fill_order balances update --- src/modules/operations.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/operations.js b/src/modules/operations.js index 4df6b62..c92d874 100644 --- a/src/modules/operations.js +++ b/src/modules/operations.js @@ -51,7 +51,9 @@ const actions = { userId }); if (!parsedData) return; - if (parsedData.operations[0].type === 'transfer') { + + const type = parsedData.operations[0].type; + if (type === 'transfer' || type === 'fill_order') { // update current user balances store.dispatch('account/fetchCurrentUser', null, { root: true }); } From 3859ea9bb0d3394857d851a3463cf427d2aad887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=BE=D0=BC=D0=B0?= Date: Thu, 5 Apr 2018 13:19:19 +0800 Subject: [PATCH 3/4] update on cancel_order --- src/modules/operations.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/operations.js b/src/modules/operations.js index c92d874..246ccda 100644 --- a/src/modules/operations.js +++ b/src/modules/operations.js @@ -53,8 +53,9 @@ const actions = { if (!parsedData) return; const type = parsedData.operations[0].type; - if (type === 'transfer' || type === 'fill_order') { + if (type === 'transfer' || type === 'fill_order' || type === 'cancel_order') { // update current user balances + // todo : maybe refactor to modify balances directly store.dispatch('account/fetchCurrentUser', null, { root: true }); } store.dispatch('assets/fetchAssets', { assets: parsedData.assetsIds }, { root: true }); From 0f4a711ac5d5ba48ba760ea1cb2e7d2f5760462e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=BE=D0=BC=D0=B0?= Date: Thu, 5 Apr 2018 13:40:48 +0800 Subject: [PATCH 4/4] lint --- src/modules/operations.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/operations.js b/src/modules/operations.js index 246ccda..572d8cb 100644 --- a/src/modules/operations.js +++ b/src/modules/operations.js @@ -52,7 +52,7 @@ const actions = { }); if (!parsedData) return; - const type = parsedData.operations[0].type; + const { type } = parsedData.operations[0]; if (type === 'transfer' || type === 'fill_order' || type === 'cancel_order') { // update current user balances // todo : maybe refactor to modify balances directly