From b98b71189fcca2635485bbdc76d3d53ebad218d3 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Fri, 20 Jan 2017 18:53:11 -0300 Subject: [PATCH] atempt to solution --- client/coral-embed-stream/src/Embed.js | 4 +-- .../src/graphql/mutations/index.js | 31 +++++++++---------- .../src/graphql/queries/index.js | 8 ++--- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index c1690aeb7..746e7bd40 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -219,6 +219,6 @@ let url = pym.parentUrl; export default compose( connect(mapStateToProps, mapDispatchToProps), - postComment(), - queryStream() + postComment, + queryStream )(Embed); diff --git a/client/coral-embed-stream/src/graphql/mutations/index.js b/client/coral-embed-stream/src/graphql/mutations/index.js index 66cb97d21..1c74d2e69 100644 --- a/client/coral-embed-stream/src/graphql/mutations/index.js +++ b/client/coral-embed-stream/src/graphql/mutations/index.js @@ -1,20 +1,19 @@ import { graphql } from 'react-apollo'; import POST_COMMENT from './postComment.graphql'; -export const postComment = () => - graphql(POST_COMMENT, { - props: ({mutate}) => ({ - postItem: ({asset_id, body}) => { - mutate({ - variables: { - asset_id, - body, - parent_id: null - } - }).then(({data}) => { - console.log('it workt'); - console.log(data); - }); - }}), - }); +export const postComment = graphql(POST_COMMENT, { + props: ({dispatch, mutate}) => ({ + postItem: ({asset_id, body}) => { + mutate({ + variables: { + asset_id, + body, + parent_id: null + } + }).then(({data}) => { + console.log('it workt'); + console.log(data); + }); + }}), +}); diff --git a/client/coral-embed-stream/src/graphql/queries/index.js b/client/coral-embed-stream/src/graphql/queries/index.js index d3b3bdb86..0e2b3cf95 100644 --- a/client/coral-embed-stream/src/graphql/queries/index.js +++ b/client/coral-embed-stream/src/graphql/queries/index.js @@ -5,8 +5,6 @@ import Pym from 'pym.js'; const pym = new Pym.Child({polling: 100}); let url = pym.parentUrl; -export const queryStream = () => - graphql(STREAM_QUERY, { - options: {variables: {asset_url: url}}, - props: props => props, - }); +export const queryStream = graphql(STREAM_QUERY, { + options: {variables: {asset_url: url}} +});