-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Надо подкачаться #16
Надо подкачаться #16
Conversation
…errors or success
♻️ Я собрал ваш пулреквест. Посмотреть можно здесь. |
♻️ Я собрал ваш пулреквест. Посмотреть можно здесь. |
♻️ Я собрал ваш пулреквест. Посмотреть можно здесь. |
♻️ Я собрал ваш пулреквест. Посмотреть можно здесь. |
js/api.js
Outdated
}).catch(() => { | ||
throw new Error('Ошибка при отправке/получении данных'); | ||
}); | ||
const getData = () => fetch(`${BASE_URL}${Route.GET_DATA}`).then((response) => response.json()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Зачем вызывать тут fetch если выше объявлена функция load
js/api.js
Outdated
}); | ||
const getData = () => fetch(`${BASE_URL}${Route.GET_DATA}`).then((response) => response.json()); | ||
const sendData = (body) => load(Route.SEND_DATA, Method.POST, body); | ||
let getPictures = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getPictures перенести в main, эта функция является более высокоуровневой и не может находиться в модуле api
функции должны быть объявлены через const и их нельзя переопределять
js/api.js
Outdated
}; | ||
}; | ||
|
||
getPictures = getPictures(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Крайне спорная конструкция, лучше завести глобальную переменную и присвоить ей результат вызова getData
js/main.js
Outdated
|
||
document.addEventListener('click', (e) => { | ||
const currentPicture = e.target.closest('.picture'); | ||
|
||
if (currentPicture) { | ||
e.preventDefault(); | ||
openBigPhotoPopup(currentPicture.dataset.photoId); | ||
getPictures().then((photos) => openBigPhotoPopup(photos, currentPicture.dataset.photoId), showDataError); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Получать данные с сервера при каждом открытии полноэкранного изображения неприемлемо
♻️ Я собрал ваш пулреквест. Посмотреть можно здесь. |
♻️ Я собрал ваш пулреквест. Посмотреть можно здесь. |
🎓 Надо подкачаться
💥 https://htmlacademy-javascript.github.io/2593079-kekstagram-2/16/