Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Irina-anat committed May 4, 2023
1 parent c286f40 commit a17cb72
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ form.addEventListener(`submit`, onSearch);

async function onSearch(evn) {
evn.preventDefault()
searchQuery = evn.currentTarget.elements.searchQuery.value.trim();
searchQuery = evn.target.elements.searchQuery.value.trim();
if (!searchQuery) {
clear()
Notify.failure("Please fill in the search field.")
Expand All @@ -42,7 +42,7 @@ async function onSearch(evn) {
resetCurretPage()
const data = await getImages(searchQuery, currentPage);
console.log(data.hits)
if (data.hits.length === 0) {
if (!data.hits.length) {
form.reset()
clear()
Notify.failure("Sorry, there are no images matching your search query. Please try again.")
Expand Down

0 comments on commit a17cb72

Please sign in to comment.