Created
September 4, 2019 10:34
-
-
Save shark-h/c6deba4d6321421f83b79d0ef714a4f6 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
addAnswer( | |
String questionID, | |
String answerID, | |
) async { | |
String addAnswer = """ | |
mutation addAnswer(\$questionID: uuid!, \$answerID: uuid!, \$userID: String!) { | |
insert_user_answers(objects: {question_id: \$questionID, answer_id: \$answerID}) { | |
affected_rows | |
} | |
} | |
"""; | |
final MutationOptions options = MutationOptions( | |
document: addAnswer, | |
variables: <String, dynamic>{ | |
'questionID': questionID, | |
'answerID': answerID, | |
'userID': user.uid, | |
}, | |
); | |
final QueryResult result = await client.mutate(options); | |
if (result.hasErrors) { | |
print(result.errors); | |
} else {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment