I found the solution ! :
export default {
methods: {
createPost() {
this.$apollo
.mutate({
mutation: createPost,
context: {
headers: {
authorization:
"Bearer JWT_TOKEN",
},
},
})
.then((data) => {
console.log(data);
})
.catch((error) => {
console.error(error);
});
},
},
mounted() {
this.createPost();
},
};