-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
03a3395
commit aa1bf39
Showing
4 changed files
with
32 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
import axios from 'axios'; | ||
const BASE_URL = "https://pixabay.com/api/"; | ||
const API_KEY = "35791203-a082b793cbab5a6f0440a6e52"; | ||
//const currentPage = 1; | ||
let page = 0 | ||
|
||
async function getImages(searchQuery, page = 1) {//, | ||
async function getImages(searchQuery, page = 1) { | ||
const params = new URLSearchParams({ | ||
key: API_KEY, | ||
q: searchQuery, | ||
image_type: 'photo', | ||
orientation: 'horizontal', | ||
safesearch: true, | ||
per_page: 40, | ||
//page | ||
}) | ||
const URL = `${BASE_URL}?${params}` | ||
const images = await axios.get(`${BASE_URL}?${params}&page=${page}`);//.then(page +=1) | ||
const images = await axios.get(`${BASE_URL}?${params}&page=${page}`); | ||
console.log(images.data) | ||
return images.data; | ||
} | ||
}; | ||
|
||
export {getImages, page} | ||
export {getImages} |