Unhandled Rejection (Error): must be defined

type Product  {
	id: ID! 
	name: String! @search(by:[hash]) 
	quantity: Int! 
	availability: Boolean! 
	price: Float! 
	image_src: String! 
	category: [Category] 
	brand: Brand 
	specification: [About] 
	description_shot: String 
	description_long: String 
}
export const UPDATE_PRODUCT = gql`
    mutation updateProduct($patch: UpdateProductInput!){
        updateProduct(input: $patch){
            product {
                id
                quantity
            }
        }
    }
`;
const [updateProduct] = useMutation(UPDATE_PRODUCT);
 updateProduct({
                        patch:
                            {
                                filter: {
                                    id: purchas.id
                                },
                                set: {
                                    quantity: qual
                                }
                            }
                    })

You have the same problem as the previous post in this correct category. You need to add the variables param. See this answer:

1 Like
{ patch:{
    filter: {id: purchas.id},
    set: {quantity: quan}}
}
Already there 'patch'))

I am only studying this technology and everything is not clear to me yet.

Thank you very much!!!

1 Like