about summary refs log tree commit diff
path: root/app/assets/javascripts/components/containers
diff options
context:
space:
mode:
authorJoachim Viide <jviide@iki.fi>2017-04-15 03:32:42 +0300
committerEugen <eugen@zeonfederated.com>2017-04-15 02:32:42 +0200
commitef879a88393598f5dd83a2ced6dfadbebe888203 (patch)
treee3d9ae4815e0b520a0152313633ba2da5ed1dbef /app/assets/javascripts/components/containers
parent9240ca6cefdec25574f329b70438c4fa4571a1e4 (diff)
Send initial state in a <script type="application/json"> tag (#1806)
Diffstat (limited to 'app/assets/javascripts/components/containers')
-rw-r--r--app/assets/javascripts/components/containers/mastodon.jsx7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/assets/javascripts/components/containers/mastodon.jsx b/app/assets/javascripts/components/containers/mastodon.jsx
index f1038bbe7..a771d1269 100644
--- a/app/assets/javascripts/components/containers/mastodon.jsx
+++ b/app/assets/javascripts/components/containers/mastodon.jsx
@@ -61,8 +61,8 @@ import { hydrateStore } from '../actions/store';
 import createStream from '../stream';
 
 const store = configureStore();
-
-store.dispatch(hydrateStore(window.INITIAL_STATE));
+const initialState = JSON.parse(document.getElementById("initial-state").textContent);
+store.dispatch(hydrateStore(initialState));
 
 const browserHistory = useRouterHistory(createBrowserHistory)({
   basename: '/web'
@@ -95,9 +95,10 @@ const Mastodon = React.createClass({
 
   componentDidMount() {
     const { locale }  = this.props;
+    const streamingAPIBaseURL = store.getState().getIn(['meta', 'streaming_api_base_url']);
     const accessToken = store.getState().getIn(['meta', 'access_token']);
 
-    this.subscription = createStream(accessToken, 'user', {
+    this.subscription = createStream(streamingAPIBaseURL, accessToken, 'user', {
 
       connected () {
         store.dispatch(connectTimeline('home'));