Skip to content

Instantly share code, notes, and snippets.

@shark-h
Created September 4, 2019 10:34
Show Gist options
  • Save shark-h/c6deba4d6321421f83b79d0ef714a4f6 to your computer and use it in GitHub Desktop.
Save shark-h/c6deba4d6321421f83b79d0ef714a4f6 to your computer and use it in GitHub Desktop.
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