This commit is contained in:
Georges KABBOUCHI 2021-08-01 13:40:37 +03:00
parent ac16d2c8b7
commit 52a085ae64
2 changed files with 8 additions and 4 deletions

View File

@ -101,11 +101,16 @@ export function useAaveV2Position(
return newPos; return newPos;
}; };
const refreshPosition = async () => {
position.value = await fetchPosition();
};
watch( watch(
web3, web3,
async val => { async val => {
if (val) { if (val) {
position.value = await fetchPosition(); refreshPosition();
} }
}, },
{ immediate: true } { immediate: true }
@ -115,7 +120,7 @@ export function useAaveV2Position(
activeAccount, activeAccount,
async val => { async val => {
if (val) { if (val) {
position.value = await fetchPosition(); refreshPosition();
} }
}, },
{ immediate: true } { immediate: true }
@ -325,6 +330,7 @@ export function useAaveV2Position(
displayPositions, displayPositions,
position, position,
fetchPosition, fetchPosition,
refreshPosition,
totalSupply, totalSupply,
totalBorrow, totalBorrow,
status, status,

View File

@ -23,8 +23,6 @@ export function useBalances() {
const { getTokenByKey } = useToken(); const { getTokenByKey } = useToken();
const fetchBalances = async (refresh = false) => { const fetchBalances = async (refresh = false) => {
await nextTick();
if (!balances.user || refresh) { if (!balances.user || refresh) {
balances.user = { balances.user = {
mainnet: await getBalances(account.value, Network.Mainnet, mainnetWeb3), mainnet: await getBalances(account.value, Network.Mainnet, mainnetWeb3),