January 2020
Intermediate to advanced
530 pages
11h 11m
English
The setBalance() method is called to set the current user balance. It is always invoked after a new transaction is submitted to the server. It calls the /customerinfo endpoint and updates the new balance to the app state, as follows:
setBalance = () => { let app = this; var url = 'http://'+ this.state.server +'/customerinfo'; fetch(url, { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', },body: JSON.stringify({ userId : app.state.userId }) }).then(function(response,error){
Read now
Unlock full access