Skip to content

Instantly share code, notes, and snippets.

@riccardogiorato
Created January 17, 2021 12:48
Show Gist options
  • Save riccardogiorato/6e82d214716a21d214059ce997c93561 to your computer and use it in GitHub Desktop.
Save riccardogiorato/6e82d214716a21d214059ce997c93561 to your computer and use it in GitHub Desktop.
import { gql, useMutation } from "@apollo/client";
/* more code */
const ADD_WISHLIST = gql`
mutation ADD_WISHLIST(
$email: String!
$plant: String!
$suggestion: String!
) {
insert_users_wishlist(
objects: { email: $email, plant: $plant, suggestion: $suggestion }
) {
affected_rows
}
}
`;
/* more code */
function App() {
/* more code */
useEffect(() => {
if (appStep === 3 && userEmail !== "") {
addToWishlistMutation({
variables: {
email: userEmail,
plant: userPlant.name,
suggestion: userPlant.category,
},
});
}
}, [appStep, userEmail, userPlant, addToWishlistMutation]);
/* more code */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment