mirror of
https://github.com/wassname/talk.git
synced 2026-07-17 11:33:39 +08:00
Adding fragments 🎉
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
fragment commentView on Comment {
|
||||
id
|
||||
body
|
||||
created_at
|
||||
user {
|
||||
id
|
||||
name: displayName
|
||||
settings {
|
||||
bio
|
||||
}
|
||||
}
|
||||
actions {
|
||||
type: action_type
|
||||
count
|
||||
current: current_user {
|
||||
id
|
||||
created_at
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,12 @@ import POST_COMMENT from './postComment.graphql';
|
||||
import POST_ACTION from './postAction.graphql';
|
||||
import DELETE_ACTION from './deleteAction.graphql';
|
||||
|
||||
import commentView from '../fragments/commentView.graphql';
|
||||
|
||||
export const postComment = graphql(POST_COMMENT, {
|
||||
options: () => ({
|
||||
fragments: [commentView]
|
||||
}),
|
||||
props: ({mutate}) => ({
|
||||
postItem: ({asset_id, body, parent_id} /* , type */ ) => {
|
||||
return mutate({
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
|
||||
fragment commentView on Comment {
|
||||
id
|
||||
body
|
||||
status
|
||||
user {
|
||||
name: displayName
|
||||
}
|
||||
actions {
|
||||
type: action_type
|
||||
count
|
||||
current: current_user {
|
||||
id
|
||||
created_at
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mutation CreateComment ($asset_id: ID!, $parent_id: ID, $body: String!) {
|
||||
createComment(asset_id:$asset_id, parent_id:$parent_id, body:$body) {
|
||||
...commentView
|
||||
|
||||
Reference in New Issue
Block a user