Testing my actionPresence

This commit is contained in:
Belén Curcio
2018-09-25 19:27:30 -03:00
parent d03583df5e
commit 6475f0c0f6
2 changed files with 35 additions and 14 deletions
@@ -35,3 +35,7 @@ export {
CreateCommentReactionMutation,
CreateCommentReactionInput,
} from "./CreateCommentReactionMutation";
export {
withDeleteCommentReactionMutation,
DeleteCommentReactionMutation,
} from "./DeleteCommentReactionMutation";
@@ -5,22 +5,34 @@ import { RespectButtonContainer_comment as CommentData } from "talk-stream/__gen
import {
CreateCommentReactionMutation,
DeleteCommentReactionMutation,
withCreateCommentReactionMutation,
withDeleteCommentReactionMutation,
} from "../../../mutations";
import RespectButton from "../components/RespectButton";
interface RespectButtonContainerProps {
createCommentReaction: CreateCommentReactionMutation;
deleteCommentReaction: DeleteCommentReactionMutation;
comment: CommentData;
}
class RespectButtonContainer extends React.Component<
RespectButtonContainerProps
> {
private onButtonClick = () =>
this.props.createCommentReaction({
private onButtonClick = () => {
const input = {
commentID: this.props.comment.id,
});
};
// const { createCommentReaction, deleteCommentReaction } = this.props;
// const { myActionPresence } = this.props.comment;
// return myActionPresence
// ? deleteCommentReaction(input)
// : createCommentReaction(input);
return this.props.createCommentReaction(input);
};
public render() {
const {
actionCounts: {
@@ -31,17 +43,22 @@ class RespectButtonContainer extends React.Component<
}
}
export default withCreateCommentReactionMutation(
withFragmentContainer<RespectButtonContainerProps>({
comment: graphql`
fragment RespectButtonContainer_comment on Comment {
id
actionCounts {
reaction {
total
export default withDeleteCommentReactionMutation(
withCreateCommentReactionMutation(
withFragmentContainer<RespectButtonContainerProps>({
comment: graphql`
fragment RespectButtonContainer_comment on Comment {
id
actionCounts {
reaction {
total
}
}
myActionPresence {
reaction
}
}
}
`,
})(RespectButtonContainer)
`,
})(RespectButtonContainer)
)
);