Adding optimistic response, and responses

This commit is contained in:
okbel
2018-02-21 19:07:39 -03:00
parent 62eb77fa4b
commit 6eb442d59a
4 changed files with 31 additions and 4 deletions
@@ -17,13 +17,12 @@ const slots = [
'commentInputDetailArea',
'commentInfoBar',
'commentActions',
'commentContent',
'commentReactions',
'commentAvatar',
'commentAuthorName',
'commentAuthorTags',
'commentTimestamp',
'textArea',
'commentContent',
];
/**
@@ -3,7 +3,12 @@ import Comment from '../components/Comment';
import { withFragments } from 'plugin-api/beta/client/hocs';
import { getSlotFragmentSpreads } from 'plugin-api/beta/client/utils';
const slots = ['commentReactions', 'commentAuthorName', 'commentTimestamp'];
const slots = [
'commentReactions',
'commentAuthorName',
'commentTimestamp',
'commentContent',
];
export default withFragments({
root: gql`
@@ -4,7 +4,7 @@ import CommentContent from '../components/CommentContent';
export default withFragments({
comment: gql`
fragment TalkPluginRTECommentContent_comment on Comment {
fragment TalkPluginRTE_CommentContent_comment on Comment {
htmlBody
}
`,
+23
View File
@@ -1,9 +1,32 @@
import Editor from './components/Editor';
import CommentContent from './containers/CommentContent';
import { gql } from 'react-apollo';
export default {
slots: {
textArea: [Editor],
commentContent: [CommentContent],
},
fragments: {
CreateCommentResponse: gql`
fragment TalkRTE_CreateCommentResponse on CreateCommentResponse {
comment {
htmlBody
}
}
`,
},
mutations: {
PostComment: ({ variables: { input } }) => {
return {
optimisticResponse: {
createComment: {
comment: {
htmlBody: input.htmlBody,
},
},
},
};
},
},
};