SHARE
TWEET

Untitled

mikeymop Oct 18th, 2019 (edited) 160 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);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top