January 2020
Intermediate to advanced
530 pages
11h 11m
English
The setAccount() method is called by the AppLogin component. Depending on whether the user clicks on Acme Inc or Apex Corp, the input parameter, 1 or 2, is sent to the method.
If the value of the input parameter is 2, indicating the customer is Apex Corp (a Bank B customer), the server state variable is set to localhost:8001, which is the listening port of the backend server of Bank B, as shown in the following code block:
if (flag == 2) { server = 'localhost:8001' };
Next, we fetch the customer's details from the backend server. We make a fetch call to the /customerinfo API endpoint, like this:
var url = 'http://'+ server +'/customerinfo'; fetch(url, { method: 'POST', headers: { 'Accept': 'application/json', ...Read now
Unlock full access