diff --git a/client/coral-embed-stream/src/CommentStream.js b/client/coral-embed-stream/src/CommentStream.js index 88ccd9faa..00a24077f 100644 --- a/client/coral-embed-stream/src/CommentStream.js +++ b/client/coral-embed-stream/src/CommentStream.js @@ -17,7 +17,6 @@ import Flag from '../../coral-plugin-flags/FlagButton' import {ReplyBox, ReplyButton} from '../../coral-plugin-replies' import Pym from 'pym.js' -console.log(authActions); const {addItem, updateItem, postItem, getItemsQuery, postAction, appendItemRelated} = itemActions const {addNotification, clearNotification} = notificationActions const {setLoggedInUser} = authActions @@ -39,11 +38,11 @@ const {setLoggedInUser} = authActions updateItem: (id, property, value) => { return dispatch(updateItem(id, property, value)) }, - postItem: (host) => (data, type, id) => { - return dispatch(postItem(data, type, id, host)) + postItem: (data, type, id) => { + return dispatch(postItem(data, type, id)) }, - getItemsQuery: (host) => (query, rootId, view) => { - return dispatch(getItemsQuery(query, rootId, view, host)) + getItemsQuery: (rootId) => { + return dispatch(getItemsQuery(rootId)) }, addNotification: (type, text) => { return dispatch(addNotification(type, text)) @@ -54,8 +53,8 @@ const {setLoggedInUser} = authActions setLoggedInUser: (user_id) => { return dispatch(setLoggedInUser(user_id)) }, - postAction: (host) => (item, action, user) => { - return dispatch(postAction(item, action, user, host)) + postAction: (item, action, user) => { + return dispatch(postAction(item, action, user)) }, appendItemRelated: (item, property, value) => { return dispatch(appendItemRelated(item, property, value)) @@ -79,17 +78,15 @@ class CommentStream extends Component { } render () { - if (this.props.config.coralHost) { - const host = this.props.config.coralHost if (Object.keys(this.props.items).length === 0) { // Loading mock asset - this.props.postItem(host)({ + this.props.postItem({ comments: [], url: 'http://coralproject.net' }, 'asset', 'assetTest') // Loading mock user - this.props.postItem(host)({name: 'Ban Ki-Moon'}, 'user', 'user_8989') + this.props.postItem({name: 'Ban Ki-Moon'}, 'user', 'user_8989') .then((id) => { this.props.setLoggedInUser(id) }) @@ -100,16 +97,14 @@ class CommentStream extends Component { return + getItemsQuery={this.props.getItemsQuery}> @@ -123,7 +118,7 @@ class CommentStream extends Component { @@ -144,7 +139,7 @@ class CommentStream extends Component { - } else { - return
Loading
- } } } diff --git a/client/coral-embed-stream/webpack.config.dev.js b/client/coral-embed-stream/webpack.config.dev.js index 95ed258cd..977300ecd 100644 --- a/client/coral-embed-stream/webpack.config.dev.js +++ b/client/coral-embed-stream/webpack.config.dev.js @@ -6,7 +6,7 @@ module.exports = { entry: [ 'babel-polyfill', 'webpack-hot-middleware/client', - './src/app' + path.join(__dirname, 'src', 'app') ], output: { path: path.join(__dirname, 'dist'), diff --git a/client/coral-embed-stream/webpack.config.js b/client/coral-embed-stream/webpack.config.js index 2b1d8ab8b..1172b79c2 100644 --- a/client/coral-embed-stream/webpack.config.js +++ b/client/coral-embed-stream/webpack.config.js @@ -2,6 +2,8 @@ const path = require('path') const webpack = require('webpack') const Copy = require('copy-webpack-plugin') +//Keeping this file for reference, it should move to a global webpack. + module.exports = { devtool: 'source-map', entry: [ @@ -9,7 +11,7 @@ module.exports = { './src/app' ], output: { - path: path.join(__dirname, 'dist'), + path: path.join(__dirname, '..', '..','dist'), filename: 'bundle.js', publicPath: '/dist/' }, diff --git a/client/coral-framework/dynamic-containers/RootContainer.js b/client/coral-framework/dynamic-containers/RootContainer.js index bfdc58d3d..42ed1c4ef 100644 --- a/client/coral-framework/dynamic-containers/RootContainer.js +++ b/client/coral-framework/dynamic-containers/RootContainer.js @@ -11,13 +11,12 @@ class RootContainer extends Component { rootId: PropTypes.string.isRequired, items: PropTypes.object.isRequired, type: PropTypes.string.isRequired, - query: PropTypes.string.isRequired, getItemsQuery: PropTypes.func.isRequired } componentDidMount () { - const {query, getItemsQuery, rootId, view} = this.props - getItemsQuery(query, rootId, view) + const {getItemsQuery, rootId} = this.props + getItemsQuery(rootId) } render () { diff --git a/client/coral-framework/store/actions/config.js b/client/coral-framework/store/actions/config.js index fc312a7e8..243cb9049 100644 --- a/client/coral-framework/store/actions/config.js +++ b/client/coral-framework/store/actions/config.js @@ -18,9 +18,10 @@ export const fetchConfig = () => async (dispatch) => { dispatch({ type: FETCH_CONFIG_REQUEST }) try { - const response = await fetch(`./talk.config.json`) - const json = await response.json() - dispatch({ type: FETCH_CONFIG_SUCCESS, config: fromJS(json) }) + //TODO: Replace with fetching config from backend + // const response = await fetch(`./talk.config.json`) + // const json = await response.json() + dispatch({ type: FETCH_CONFIG_SUCCESS, config: fromJS({}) }) } catch (error) { dispatch({ type: FETCH_CONFIG_FAILED }) } diff --git a/client/coral-framework/store/actions/items.js b/client/coral-framework/store/actions/items.js index 75c631a03..c797f0a8f 100644 --- a/client/coral-framework/store/actions/items.js +++ b/client/coral-framework/store/actions/items.js @@ -88,9 +88,9 @@ export const appendItemRelated = (item_id, property, value) => { * @dispatches * A set of items to the item store */ -export function getItemsQuery (query, rootId, view, host) { +export function getItemsQuery (query, rootId) { return (dispatch) => { - return fetch(host + '/v1/exec/' + query + '/view/' + view + '/' + rootId) + return fetch('/v1/exec/view/' + rootId) .then( response => { return response.ok ? response.json() : Promise.reject(response.status + ' ' + response.statusText) @@ -120,9 +120,9 @@ export function getItemsQuery (query, rootId, view, host) { * A set of items to the item store */ -export function getItemsArray (ids, host) { +export function getItemsArray (ids) { return (dispatch) => { - return fetch(host + '/v1/item/' + ids) + return fetch('/v1/item/' + ids) .then( response => { return response.ok ? response.json() @@ -152,7 +152,7 @@ export function getItemsArray (ids, host) { * The newly put item to the item store */ -export function postItem (data, type, id, host) { +export function postItem (data, type, id) { return (dispatch) => { let item = { type, @@ -166,7 +166,7 @@ export function postItem (data, type, id, host) { method: 'POST', body: JSON.stringify(item) } - return fetch(host + '/v1/item', options) + return fetch('/v1/item', options) .then( response => { return response.ok ? response.json() @@ -198,13 +198,13 @@ export function postItem (data, type, id, host) { * */ -export function postAction (item, action, user, host) { +export function postAction (item, action, user) { return (dispatch) => { let options = { method: 'POST' } dispatch(appendItemArray(item, action, user)) - return fetch(host + '/v1/action/' + action + '/user/' + user + '/on/item/' + item, options) + return fetch('/v1/action/' + action + '/user/' + user + '/on/item/' + item, options) .then( response => { return response.ok ? response.text() diff --git a/package.json b/package.json index ab8a0c865..289f5488d 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "app.js", "scripts": { "lint": "eslint .", - "start": "./bin/www" + "start": "./bin/www", + "embed-start":"node client/coral-embed-stream/dev-server.js" }, "repository": { "type": "git",