Last active
May 25, 2019 13:24
-
-
Save irridescentrambler/2d6b5883383e641ec826ced626617f55 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function callDogApi(url){ | |
const promise = fetch(url); | |
promise.then((response)=> { | |
if(response.status === 200){ | |
console.log('Api call successful'); | |
console.log(response); | |
}else{ | |
throw new Error(response.status); | |
} | |
}).catch((error)=> { | |
console.log(error); | |
}); | |
} | |
callDogApi("https://dog.ceo/api/breed/ABD/images/random"); | |
callDogApi("https://dog.ceo/api/breed/Husky/images/random"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment