Created
January 17, 2021 12:48
-
-
Save riccardogiorato/6e82d214716a21d214059ce997c93561 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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