From c16f3b8fbeb4a110bc3a1a261cf66b6415bfce93 Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Fri, 20 Jan 2017 11:54:18 -0700 Subject: [PATCH] change scalar URL type for a bit --- .../coral-embed-stream/src/CommentStream.js | 23 +++++++++++-------- graph/typeDefs.js | 4 +--- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/client/coral-embed-stream/src/CommentStream.js b/client/coral-embed-stream/src/CommentStream.js index 4750f5880..9f08a2259 100644 --- a/client/coral-embed-stream/src/CommentStream.js +++ b/client/coral-embed-stream/src/CommentStream.js @@ -37,8 +37,6 @@ const {addItem, updateItem, postItem, getStream, postAction, deleteAction, appen const {addNotification, clearNotification} = notificationActions; const {logout, showSignInDialog} = authActions; -const assetID = '4807a33a-894a-4351-8eb5-a8e0091af568'; - class CommentStream extends Component { constructor (props) { @@ -64,10 +62,10 @@ class CommentStream extends Component { componentDidMount () { - // Set up messaging between embedded Iframe an parent component - this.pym = new Pym.Child({polling: 100}); + return; + + // Set up messaging between embedded Iframe an parent component - let path = this.pym.parentUrl.split('#')[0]; if (!path) { path = window.location.href.split('#')[0]; @@ -363,8 +361,8 @@ fragment commentView on Comment { } } -query AssetQuery($asset_id: ID!) { - asset(id: $asset_id) { +query AssetQuery($asset_url: String!) { + asset(url: $asset_url) { id title url @@ -401,13 +399,20 @@ const postComment = gql` } `; +const pym = new Pym.Child({polling: 100}); + +let url = pym.parentUrl; + +console.log('pym.parentUrl', url); + export default compose( graphql(StreamQuery, { - options: { variables: { asset_id: assetID } }, + // pass in the assetURL at componentDidMount + options: { variables: { asset_url: url } }, props: props => props, }), graphql(postComment, { - options: { variables: { asset_id: assetID } }, + options: { variables: { asset_url: url } }, props: ({ownProps, mutate}) => ({ postComment: (data) => mutate(data) }), diff --git a/graph/typeDefs.js b/graph/typeDefs.js index 5b7bbaa60..aadc7f57d 100644 --- a/graph/typeDefs.js +++ b/graph/typeDefs.js @@ -75,12 +75,10 @@ type Asset { closedAt: String } -scalar URL - type RootQuery { settings: Settings assets: [Asset] - asset(id: ID, url: URL): Asset + asset(id: ID, url: String): Asset me: User }