Skip to content

Commit

Permalink
Надо подкачаться
Browse files Browse the repository at this point in the history
  • Loading branch information
lenapokrovskaya committed Jan 17, 2025
1 parent 1474a62 commit 9507ef0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions js/api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const BASE_URL = 'https://31.javascript.htmlacademy.pro/kekstagram';

const Route = {
GET_DATA: '/data',
SEND_DATA: '/',
Expand All @@ -18,7 +19,7 @@ const load = (route, errorText, method = Method.GET, body = null) =>
fetch(`${BASE_URL}${route}`, { method, body })
.then((response) => {
if (!response.ok) {
throw new Error(ErrorText.GET_DATA);
throw new Error();
}
return response.json();
})
Expand All @@ -29,4 +30,4 @@ const load = (route, errorText, method = Method.GET, body = null) =>
const getData = () => load(Route.GET_DATA, ErrorText.GET_DATA);
const sendData = (body) => load(Route.SEND_DATA, ErrorText.SEND_DATA, Method.POST, body);

export { getData, sendData };
export {getData, sendData};
4 changes: 2 additions & 2 deletions js/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {clearComments} from './comments.js';
const renderModal = (posts) => {
const bigPictureElement = document.body.querySelector('.big-picture');
const picturesParentElement = document.querySelector('.pictures');
const pictureCloseButton = bigPictureElement.querySelector('.big-picture__cancel');
const pictureCloseButtonElement = bigPictureElement.querySelector('.big-picture__cancel');


//Функция-обработчик закрытия модалки ESC
Expand Down Expand Up @@ -34,7 +34,7 @@ const renderModal = (posts) => {
});
};

onCloseButtonClick(pictureCloseButton);
onCloseButtonClick(pictureCloseButtonElement);

//Функция открытия модалки
const openModal = () => {
Expand Down
6 changes: 3 additions & 3 deletions js/upload-photo-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const imgUploadFormInputElement = imgUploadFormElement.querySelector('.img-uploa
const hashtagsInputElement = imgUploadFormElement.querySelector('.text__hashtags');
const descriptionInutElement = imgUploadFormElement.querySelector('.text__description');
const imgUploadOverlay = imgUploadFormElement.querySelector('.img-upload__overlay');
const buttonUploadCancel = imgUploadFormElement.querySelector('.img-upload__cancel');
const buttonUploadCancelElement = imgUploadFormElement.querySelector('.img-upload__cancel');
const effectsElement = imgUploadFormElement.querySelector('.img-upload__effects');

//Функция-обработчик закрытия формы по ESC
Expand All @@ -31,7 +31,7 @@ function closeUploadForm() {
imgUploadOverlay.classList.add('hidden');
bodyElement.classList.remove('modal-open');
document.removeEventListener('keydown', onDocumentKeydown);
buttonUploadCancel.removeEventListener('click', onCloseButtonClick);
buttonUploadCancelElement.removeEventListener('click', onCloseButtonClick);
imgUploadFormInputElement.value = '';
resetPhotoEditor();
}
Expand All @@ -42,7 +42,7 @@ const openUploadForm = () => {
imgUploadOverlay.classList.remove('hidden');
bodyElement.classList.add('modal-open');
document.addEventListener('keydown', onDocumentKeydown);
buttonUploadCancel.addEventListener('click', onCloseButtonClick);
buttonUploadCancelElement.addEventListener('click', onCloseButtonClick);
effectsElement.addEventListener('change', onSliderEffectsChange);
});
};
Expand Down

0 comments on commit 9507ef0

Please sign in to comment.