Skip to content

Надо подкачаться #12

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

Merged
merged 4 commits into from
May 30, 2025

Conversation

Allenyonok
Copy link
Contributor

@Allenyonok Allenyonok commented May 28, 2025

@keksobot
Copy link
Contributor

♻️ Я собрал ваш пулреквест. Посмотреть можно здесь.

keksobot pushed a commit that referenced this pull request May 28, 2025
js/api.js Outdated
`${BASE_URL}/${endpoint[0] === '/' ? endpoint.slice(1) : endpoint}`;

const dataHandler = async (response) => {
if (response.status < 400) {
Copy link
Collaborator

@Spearance Spearance May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

400 — магическое и должен быть 200

.then((posts) => {
drawMiniatures(posts);
})
.catch(() => {});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

добавить ошибку

const successTemplate = document.getElementById('success').content;

const showMessage = (template, config = {}) => {
const timeout = (config.timeout ?? 5) * 1000;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

магические значения

@keksobot
Copy link
Contributor

♻️ Я собрал ваш пулреквест. Посмотреть можно здесь.

keksobot pushed a commit that referenced this pull request May 30, 2025
@keksobot
Copy link
Contributor

♻️ Я собрал ваш пулреквест. Посмотреть можно здесь.

keksobot pushed a commit that referenced this pull request May 30, 2025
@keksobot
Copy link
Contributor

♻️ Я собрал ваш пулреквест. Посмотреть можно здесь.

keksobot pushed a commit that referenced this pull request May 30, 2025
@keksobot
Copy link
Contributor

♻️ Я собрал ваш пулреквест. Посмотреть можно здесь.

keksobot pushed a commit that referenced this pull request May 30, 2025
@keksobot
Copy link
Contributor

♻️ Я собрал ваш пулреквест. Посмотреть можно здесь.

keksobot pushed a commit that referenced this pull request May 30, 2025
@keksobot keksobot merged commit 2119935 into htmlacademy-javascript:master May 30, 2025
1 check passed

const isSuccess = (response) => {
// Статусы 200..299 считаем успешными (https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status)
if (response.status >= 200 && response.status < 300) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

числа 200 и 300 считаются магическими, надо вынести в константы


const isError = (response) => {
// 400 и далее - ошибка (всё та же спецификация)
if (response.status >= 400) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

400 магическое

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants