Skip to content

Commit b9ed3fe

Browse files
authored
Merge pull request #15 from suntira/master
2 parents 771c2e9 + 7eb0d86 commit b9ed3fe

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

js/api.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
const SERVER_URL = 'https://31.javascript.htmlacademy.pro/kekstagram';
22

3-
const routes = {
3+
const Routes = {
44
GET_DATA: '/data',
55
SEND_DATA: '/',
66
};
77

8-
const methods = {
8+
const Methods = {
99
GET: 'GET',
1010
POST: 'POST',
1111
};
1212

13-
const errorTexts = {
14-
[methods.GET]: 'Не удалось загрузить данные. Попробуйте ещё раз',
15-
[methods.POST]: 'Не удалось отправить данные формы',
13+
const ErrorTexts = {
14+
[Methods.GET]: 'Не удалось загрузить данные. Попробуйте ещё раз',
15+
[Methods.POST]: 'Не удалось отправить данные формы',
1616
};
1717

18-
const load = (route, method = methods.GET, body = null) =>
18+
const load = (route, method = Methods.GET, body = null) =>
1919
fetch(`${SERVER_URL}${route}`, { method, body })
2020
.then((response) => {
2121
if (!response.ok) {
22-
throw new Error(errorTexts[method]);
22+
throw new Error(ErrorTexts[method]);
2323
}
2424
return response.json();
2525
});
2626

27-
const getData = () => load(routes.GET_DATA);
28-
const sendData = (body) => load(routes.SEND_DATA, methods.POST, body);
27+
const getData = () => load(Routes.GET_DATA);
28+
const sendData = (body) => load(Routes.SEND_DATA, Methods.POST, body);
2929

3030
export { getData, sendData };

js/comments.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,5 @@ const initComments = (comments) => {
5757
export {
5858
renderNextComments,
5959
closeComments,
60-
initComments,
61-
currentPhotoComments,
62-
shownCommentsCount
60+
initComments
6361
};

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"lint": "eslint js/"
2222
},
2323
"engines": {
24-
"node": "^20",
25-
"npm": "^10"
24+
"node": "20.10.0",
25+
"npm": "10.2.3"
2626
}
2727
}

0 commit comments

Comments
 (0)