Advertisement
mikeymop

Untitled

Oct 18th, 2019
673
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             let data;
  2.             const dataPromise = fetch(url) // Call the fetch function passing the url of the API as a parameter
  3.               .then((result) => {
  4.                   data = result.json();
  5.                 })
  6.               .catch((err) => {
  7.                 // This is where you run code if the server returns any errors
  8.                 console.log("logon error " + err);
  9.                 // this.util.log("logon error " + error);
  10.                 if (callback) { callback(null, err); }
  11.                 this.util.raiseEvent("onlogon", {user: null});
  12.               });
  13.             data = Promise.resolve(dataPromise);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement