Edit UI sends editComment mutation, handles errors

This commit is contained in:
Benjamin Goering
2017-05-02 22:07:23 -05:00
parent aa18a433f8
commit b9a3466e2e
10 changed files with 95 additions and 10 deletions
@@ -0,0 +1,7 @@
mutation EditComment ($id: ID!, $edit: EditCommentInput) {
editComment(id:$id, edit:$edit) {
errors {
translation_key
}
}
}
@@ -8,6 +8,7 @@ import ADD_COMMENT_TAG from './addCommentTag.graphql';
import REMOVE_COMMENT_TAG from './removeCommentTag.graphql';
import IGNORE_USER from './ignoreUser.graphql';
import STOP_IGNORING_USER from './stopIgnoringUser.graphql';
import EDIT_COMMENT from './editComment.graphql';
import MY_IGNORED_USERS from '../queries/myIgnoredUsers.graphql';
import STREAM_QUERY from '../queries/streamQuery.graphql';
@@ -191,3 +192,24 @@ export const stopIgnoringUser = graphql(STOP_IGNORING_USER, {
};
}
});
export const editComment = graphql(EDIT_COMMENT, {
props: ({mutate, ownProps}) => {
return {
editComment: (id, edit) => {
return mutate({
variables: {
id,
edit,
},
refetchQueries: [
{
query: STREAM_QUERY,
variables: variablesForStreamQuery(ownProps),
}
]
});
}
};
}
});
+2
View File
@@ -23,8 +23,10 @@
"comments": "comments",
"commentIsIgnored": "This comment is hidden because you ignored this user.",
"error": {
"editWindowExpired": "You can no longer edit this comment. The time window to do so has expired.",
"emailNotVerified": "Email address {0} not verified.",
"email": "Not a valid E-Mail",
"networkError": "Failed to connect to server. Check your internet connection and try again.",
"password": "Password must be at least 8 characters",
"username": "Usernames can contain letters, numbers and _ only",
"confirmPassword": "Passwords don't match. Please, check again",