Skip to content
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

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

Merged
merged 11 commits into from
Jan 22, 2025

Conversation

furidasha
Copy link
Contributor

@furidasha furidasha commented Jan 19, 2025

@keksobot keksobot changed the title Добавляет загрузку и отправку данных на сервер Надо подкачаться Jan 19, 2025
const hashtagInputElement = formElement.querySelector('.text__hashtags');
const descriptionInputElement = formElement.querySelector('.text__description');

const clearForm = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Вместо clearForm сбрасывай просто методом .reset() у формы

js/api.js Outdated
import { cloneElement } from './utils.js';

const getData = () => {
return fetch('https://31.javascript.htmlacademy.pro/kekstagram/data')
Copy link
Collaborator

Choose a reason for hiding this comment

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

URL нужно вынести в константу

js/api.js Outdated
cloneElement(errorTemplateElement);
setTimeout(() => {
document.querySelector('.data-error').classList.add('hidden');
}, 5000);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Таймаут нужно вынести в константу

import { closeModal, onEscapeDown } from './photo-edit-modal.js';
import { pristine } from './photo-edit-form-validation.js';
import { cloneElement } from './utils.js';

Copy link
Collaborator

Choose a reason for hiding this comment

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

Для getData и sendData нужно создать функцию с общей логикой

js/api.js Outdated
submitButtonElement.disabled = true;

fetch(
'https://31.javascript.htmlacademy.pro/kekstagram',
Copy link
Collaborator

Choose a reason for hiding this comment

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

'https://31.javascript.htmlacademy.pro/kekstagram' нужно вынести в константу

js/api.js Outdated

if (pristine.validate()) {
const formData = new FormData(evt.target);
submitButtonElement.disabled = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

submitButtonElement.disabled = true; -> submitButtonElement.setAttribute('disabled', 'true');

js/api.js Outdated
fetch(
'https://31.javascript.htmlacademy.pro/kekstagram',
{
method: 'POST',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Для методов GET и POST нужно сделать перечисление

@keksobot keksobot merged commit e1f08f2 into htmlacademy-javascript:master Jan 22, 2025
1 check passed
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