pascalo
06/11/2017, 7:46 PM${GRAPHQL_ENDPOINT}
, {
method: 'post',
headers: {
'Content-Type': 'application/json',
'Authorization': Bearer ${PAT}
},
body: '{"query":"mutation { createPost( imageUrl: \"https://facebook.github.io/react/img/logo_og.png\" description: \"my-great-meteor\") {id }}"}',
})
.then((response) => {
if (response.status > 400) {
throw new Error("Bad response from server")
} else {
return response.json()
}
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.log(error);
});