mirror of
https://github.com/wassname/talk.git
synced 2026-07-19 11:28:50 +08:00
45 lines
971 B
JavaScript
45 lines
971 B
JavaScript
import {graphql} from 'react-apollo';
|
|
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({
|
|
variables: {
|
|
asset_id,
|
|
body,
|
|
parent_id
|
|
}
|
|
});
|
|
}}),
|
|
});
|
|
|
|
export const postAction = graphql(POST_ACTION, {
|
|
props: ({mutate}) => ({
|
|
postAction: (action) => {
|
|
return mutate({
|
|
variables: {
|
|
action
|
|
}
|
|
});
|
|
}}),
|
|
});
|
|
|
|
export const deleteAction = graphql(DELETE_ACTION, {
|
|
props: ({mutate}) => ({
|
|
deleteAction: (id) => {
|
|
return mutate({
|
|
variables: {
|
|
id
|
|
}
|
|
});
|
|
}}),
|
|
});
|