Skip to content

Instantly share code, notes, and snippets.

@Hansanghyeon
Last active April 21, 2023 00:45
Show Gist options
  • Save Hansanghyeon/8c6d1e0271586eb91b7ab85e52205dc4 to your computer and use it in GitHub Desktop.
Save Hansanghyeon/8c6d1e0271586eb91b7ab85e52205dc4 to your computer and use it in GitHub Desktop.
axios graphql reqeust
// var axios = require("axios")
// env
const token = ``;
const endpoint = ``;
// axios graphql request example
const headers = {
"content-type": "application/json",
Authorization: `Bearer ${token}`
};
const graphqlQuery = {
query: `
query NewQuery {
ty_order_sectionCollection {
edges {
node {
id
created_at
ty_order_section_itemCollection {
edges {
node {
id
name
option
original_price
sale_price
count
total_price
status
}
}
}
}
}
}
}
`
};
const response = axios
.post(endpoint, graphqlQuery, headers)
.then((res) => console.log(res.data));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment