When attempting to run a delete query that requires an ID, I encountered an error stating: "Variable "$id" of required type "ID!" was not provided"
The Query:
export const DELETE_CUSTOMER = gql`
mutation deleteCustomer($id:ID!){
deleteCustomer(
_id: $id
)
}
`
The Mutation code within vuex actions:
deleteCustomer(vuexContext, id){
return apollo
.mutate({
mutation: DELETE_CUSTOMER,
variables: id.toString()
})
.then(()=>{
vuexContext.commit('deleteCustomer', id.toString());
})
.catch((err) => {
throw err;
});
}