Please find the source and instructions @ https://github.com/kartheekgj/paypalnodeIntegration
All about very small logical and programming problems. Complex theories made simple to understand
Tuesday, September 7, 2021
Async Await Simple example
let url1 = "https://reqres.in/api/users";
async function users() {
let response = await fetch(url1);
let user = await response.json();
return user;
};
let singleUrl = "https://reqres.in/api/users/";
async function userData(data) {
let url = singleUrl + data;
let response = await fetch(url);
let user = await response.json();
return user;
};
users().then(respData => {
console.log(respData.data);
var userid = respData.data[0]['id']
userData(userid).then((responseData) => {
console.log(responseData);
});
});
Subscribe to:
Posts (Atom)