From 52a085ae64334bacef46ae0e7cd3bfe8708fe8d8 Mon Sep 17 00:00:00 2001 From: Georges KABBOUCHI Date: Sun, 1 Aug 2021 13:40:37 +0300 Subject: [PATCH] wip --- composables/useAaveV2Position.ts | 10 ++++++++-- composables/useBalances.ts | 2 -- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/composables/useAaveV2Position.ts b/composables/useAaveV2Position.ts index 9282ea5..f24a540 100644 --- a/composables/useAaveV2Position.ts +++ b/composables/useAaveV2Position.ts @@ -101,11 +101,16 @@ export function useAaveV2Position( return newPos; }; + const refreshPosition = async () => { + position.value = await fetchPosition(); + }; + + watch( web3, async val => { if (val) { - position.value = await fetchPosition(); + refreshPosition(); } }, { immediate: true } @@ -115,7 +120,7 @@ export function useAaveV2Position( activeAccount, async val => { if (val) { - position.value = await fetchPosition(); + refreshPosition(); } }, { immediate: true } @@ -325,6 +330,7 @@ export function useAaveV2Position( displayPositions, position, fetchPosition, + refreshPosition, totalSupply, totalBorrow, status, diff --git a/composables/useBalances.ts b/composables/useBalances.ts index dab6907..6290d50 100644 --- a/composables/useBalances.ts +++ b/composables/useBalances.ts @@ -23,8 +23,6 @@ export function useBalances() { const { getTokenByKey } = useToken(); const fetchBalances = async (refresh = false) => { - await nextTick(); - if (!balances.user || refresh) { balances.user = { mainnet: await getBalances(account.value, Network.Mainnet, mainnetWeb3),