axios graphql reqeust
RUN TEST
axios graphql reqeust
RUN TEST
// 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)); |