Skip to content

Commit

Permalink
fixes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
thepiwo authored and AtanasKrondev committed Jun 17, 2021
1 parent 301a72c commit 9d0f218
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 107 deletions.
160 changes: 57 additions & 103 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export default {
} else {
this.setAddress(address);
}
await this.$store.dispatch('initMiddleware');
await this.$store.dispatch('fetchUserInfo');
},
},
Expand Down
7 changes: 4 additions & 3 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import backend from './modules/backend';
import aeternity from './modules/aeternity';
// eslint-disable-next-line import/no-cycle
import Backend from '../utils/backend';
import { handleUnknownError, atomsToAe } from '../utils';
import { handleUnknownError } from '../utils';

Vue.use(Vuex);

Expand Down Expand Up @@ -54,7 +54,7 @@ export default new Vuex.Store({
const result = await middleware.getAex9Balance(contractAddress, address);
return new BigNumber(result.amount || 0).toFixed();
},
async updateTokensBalanceAndPrice({ state: { address }, commit, dispatch }) {
async updateTokensBalanceAndPrice({ state: { address, middleware }, commit, dispatch }) {
const tokens = await Backend.getTokenBalances(address);
let knownTokens;
try {
Expand All @@ -63,6 +63,7 @@ export default new Vuex.Store({
handleUnknownError(error);
return;
}
if (!middleware) await dispatch('initMiddleware');
await Promise.all(Object.entries(tokens).map(async ([token]) => {
commit('addTokenBalance', {
token,
Expand Down Expand Up @@ -119,7 +120,7 @@ export default new Vuex.Store({
dispatch('updateUserProfile'),
(async () => {
const balance = await sdk.balance(address).catch(() => 0);
commit('updateBalance', atomsToAe(balance).toFixed(2));
commit('updateBalance', balance);
})(),
dispatch('updateTokensBalanceAndPrice'),
]);
Expand Down

0 comments on commit 9d0f218

Please sign in to comment.