diff --git a/lib/index.html b/lib/index.html index 0e97ce8..d32f536 100644 --- a/lib/index.html +++ b/lib/index.html @@ -31,7 +31,6 @@

Random Cat API

  • 14: Sinks
  • 15: Clothes
  • -
    diff --git a/lib/script.js b/lib/script.js index e69de29..306f30e 100644 --- a/lib/script.js +++ b/lib/script.js @@ -0,0 +1,28 @@ +const url = `https://api.thecatapi.com/v1/images/search`; + +let header = { + 'x-api-key':'live_MWhL6d9uLe1SLmWjK7AELzKHa6cXS2aR1rX0GWNmWQFAai1IQo1eumVnhYG7RdHf' +} + +const catButton = document.querySelector(`.randomButton`); + +catButton.addEventListener('click', handleClick) +// const container = document. + +function handleClick() { +fetch(url, { header }) + .then((res) => res.json()) + .then((res) => { + let randImage = document.querySelector(".randomCatImage"); + randImage.src = res[0].url; + }); +} + + + +// function displayData(data){} + +// function displayCat(url, ) { + + +// } \ No newline at end of file