Skip to content

Commit

Permalink
Show loading while getting all accounts on Send page
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaw3d committed Jan 22, 2022
1 parent 0c2d3be commit d5af6aa
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/popup/pages/Send/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,12 @@ class SendPage extends React.Component {
async componentDidMount() {
let { isWithdraw } = this.pageConfig
this.netConfigAction()
this.getAllAccounts()

Loading.show()
const allAccounts = await this.getAllAccounts()
this.callSetState({ allAccounts: allAccounts })
Loading.hide()

if(isWithdraw){
await this.fetchParatimeData()
}else{
Expand Down Expand Up @@ -368,15 +373,16 @@ class SendPage extends React.Component {
Loading.hide()
}
}
getAllAccounts() {
sendMsg({
action: WALLET_GET_ALL_ACCOUNT,
},
/** @param {GetAllAccountsResponse} account */
(account) => {
this.callSetState({
allAccounts: account.accounts,
})
/**
* @returns {Promise<GetAllAccountsResponse['accounts']>}
*/
async getAllAccounts() {
return new Promise(resolve => {
sendMsg(
{ action: WALLET_GET_ALL_ACCOUNT },
/** @param {GetAllAccountsResponse} account */
(account) => resolve(account.accounts)
)
})
}

Expand Down

0 comments on commit d5af6aa

Please sign in to comment.