Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let data;
- const dataPromise = fetch(url) // Call the fetch function passing the url of the API as a parameter
- .then((result) => {
- data = result.json();
- })
- .catch((err) => {
- // This is where you run code if the server returns any errors
- console.log("logon error " + err);
- // this.util.log("logon error " + error);
- if (callback) { callback(null, err); }
- this.util.raiseEvent("onlogon", {user: null});
- });
- data = Promise.resolve(dataPromise);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement