Refactor axios & Owner page

This commit is contained in:
saplf
2018-10-23 12:49:49 +08:00
parent 6a2eaaa175
commit 673e4a11b7
4 changed files with 29 additions and 23 deletions

View File

@@ -1,3 +1,5 @@
import axios from 'axios'
export default {
namespaced: true,
@@ -27,15 +29,30 @@ export default {
],
fetching: false,
filter: '',
balance: 0,
},
mutations: {
inputFilter(state, filter) {
state.filter = filter
},
updateBalance(state, balance) {
state.balance = balance
},
},
actions: {
async queryAccount({ state, commit }) {
let account = sessionStorage.getItem('KEY_ACCOUNT')
try {
account = JSON.parse(account)
const result = await axios.post('api/Account/getBalance', {
Account: { address: account.address },
})
commit('updateBalance', result.data || 0)
} catch (e) {}
},
},
getters: {},