This commit is contained in:
Belen Curcio
2017-07-13 12:15:13 -03:00
parent 195592b9ab
commit 8d4c0c6721
+6 -5
View File
@@ -27,7 +27,10 @@ export default (tag) => (WrappedComponent) => {
}
}
`;
const isTagged = (tags) =>
!!tags.filter((t) => t.tag.name === Tag.toUpperCase()).length;
const withAddTag = withMutation(
gql`
mutation AddTag($id: ID!, $asset_id: ID!, $name: String!) {
@@ -112,7 +115,7 @@ export default (tag) => (WrappedComponent) => {
class WithTags extends React.Component {
postTag = () => {
postTag() {
const {comment, asset} = this.props;
this.props.addTag({
@@ -122,7 +125,7 @@ export default (tag) => (WrappedComponent) => {
});
}
deleteTag = () => {
deleteTag() {
const {comment, asset} = this.props;
this.props.removeTag({
@@ -135,8 +138,6 @@ export default (tag) => (WrappedComponent) => {
render() {
const {comment} = this.props;
const isTagged = (tags) => !!tags.filter((t) => t.tag.name === Tag.toUpperCase()).length;
const alreadyTagged = isTagged(comment.tags);
return <WrappedComponent