I have an Apollo GraphQL mutation. This mutation accepts two variables.
I would like to read these variables once the mutation is fired (not as response from the backed).
I need to know these variables because I want to use them inside the onCompleted function.
My code:
const [tripleEntity] = useMutation(TRIPLE_ENTITY, {
context: { clientName: 'redzor' },
refetchQueries: ['listProjects']
})
What I would like:
const [tripleEntity] = useMutation(TRIPLE_ENTITY, {
context: { clientName: 'redzor' },
refetchQueries: ['listsEntities'],
onCompleted(response, variables): {
console.log(variables) // Where "variables" are the input necessary to fire this mutation
myFunction(variables) // This is the function that needs the input variables
}
})