mirror of
https://github.com/wassname/talk.git
synced 2026-08-11 11:27:10 +08:00
Adding optimistic response, and responses
This commit is contained in:
@@ -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
|
||||
}
|
||||
`,
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user