Skip to content

Commit

Permalink
fix: возвращает путь запросов по заданию, так как сервер заработал.
Browse files Browse the repository at this point in the history
  • Loading branch information
TatianaSenatorova committed Dec 14, 2024
1 parent b0ce594 commit 867425c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
6 changes: 2 additions & 4 deletions js/api.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// const BASE_URL = 'https://31.javascript.htmlacademy.pro/kekstagram';
const BASE_URL = 'https://a4583caa5935373e.mokky.dev/html_keksogram';
const BASE_URL = 'https://31.javascript.htmlacademy.pro/kekstagram';

const Route = {
GET_DATA: '',
// GET_DATA: '/data',
GET_DATA: '/data',
SEND_DATA: '/',
};

Expand Down
1 change: 1 addition & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import './effects-photo.js';
import { getData, ErrorIdTemplates } from './api.js';
import { showRequestInfoTimeout, debounce } from './utils.js';
import { showFilters, setFilterClick } from './filters.js';
import './upload-photo.js';

const PHOTO_ITEMS_NUMBER = 25;
const RERENDER_DELAY = 500;
Expand Down
18 changes: 18 additions & 0 deletions js/upload-photo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { imgUploadForm } from './open-form.js';

const FILE_TYPES = ['jpg', 'jpeg', 'png'];

const fileChooser = imgUploadForm.querySelector('.img-upload__input');

const imgPhotoPreview = imgUploadForm.querySelector('.img-upload__preview img');

fileChooser.addEventListener('change', () => {
const file = fileChooser.files[0];
const fileName = file.name.toLowerCase();

const matches = FILE_TYPES.some((it) => fileName.endsWith(it));

if (matches) {
imgPhotoPreview.src = URL.createObjectURL(file);
}
});

0 comments on commit 867425c

Please sign in to comment.