From 36cf887a1c395b554a000d8b7ab264fdf50af6ce Mon Sep 17 00:00:00 2001 From: Matviienko Ruslana <91379069+Ruwiseturtle@users.noreply.github.com> Date: Thu, 3 Aug 2023 15:15:16 +0300 Subject: [PATCH] hw10 --- src/js/cat-api.js | 4 ++-- src/js/index.js | 30 ++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/js/cat-api.js b/src/js/cat-api.js index ca602dd..cd56e15 100644 --- a/src/js/cat-api.js +++ b/src/js/cat-api.js @@ -1,8 +1,7 @@ import axios from 'axios'; const BASE_URL = 'https://api.thecatapi.com/v1'; -const API_KEY = - 'live_NqCT8Nwkxuj6edZ1OwQGKuojQMkYLWj7L4oQ3fZLryh0xj2BQo0SHp9dUXgOOBta'; +const API_KEY = 'live_NqCT8Nwkxuj6edZ1OwQGKuojQMkYLWj7L4oQ3fZLryh0xj2BQo0SHp9dUXgOOBta'; export function fetchBreeds(URL) { return axios.get(URL).then(result => { @@ -11,6 +10,7 @@ export function fetchBreeds(URL) { } export function fetchCatByBreed(breedId) { + console.log(breedId); return axios .get(`${BASE_URL}/images/search?api_key=${API_KEY}&breed_ids=${breedId}`) .then(result => { diff --git a/src/js/index.js b/src/js/index.js index ac3916b..7925a16 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -27,17 +27,15 @@ function renderData(dataCat) { loaderItem.hidden = true; selectBreed.hidden = false; - sectionLoad.hidden = true; - - new SlimSelect({ - select: '#selectBreed' - }); - + sectionLoad.hidden = true; + + new SlimSelect({ + select: '#selectBreed', + }); } function errorfetchData() { loaderItem.hidden = true; - // errorItem.hidden = false; } //слідкуємо за тим, яку породу користувач вибрав @@ -48,12 +46,24 @@ function showInfoBreed(e) { } function showCat(infoCat) { - console.log(infoCat); + divInfoCat.innerHTML = ''; const markup = createMarkupCatShow(infoCat); + console.log(markup); divInfoCat.innerHTML = markup; + console.log(divInfoCat); } +Notiflix.Notify.init({ + width: '480px', + position: 'left-top', + distance: '90px', + opacity: 1, + fontSize: '20px', + clickToClose: true, + timeout: 1000, + // ... +}); + function errorGetInfoCat(error) { - // Notiflix.Notify.warning(error); - console.log('x'); + Notiflix.Notify.failure('Немає інформації по цьому котику!'); }