Skip to content

Instantly share code, notes, and snippets.

@nachodd
Created November 19, 2019 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nachodd/ae51edabbe19adb7f5bb6bc4c2542a0d to your computer and use it in GitHub Desktop.
Save nachodd/ae51edabbe19adb7f5bb6bc4c2542a0d to your computer and use it in GitHub Desktop.
api calls example
import axios from "axios"
export function getSellers() {
return axios({
url: "v1/sellers/",
method: "get",
})
}
export function createInvoice(data) {
return axios({
url: "v1/invoices",
method: "post",
data,
})
}
export function getImages(searchQuery) {
const apiKey = process.env.PIXABAY_TOKEN
const url = `https://pixabay.com/api/?key=${apiKey}&q=${searchQuery}s&image_type=photo&per_page=15&safesearch=true`
return axios({
url,
method: "get",
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment