mirror of
https://github.com/wassname/talk.git
synced 2026-07-24 13:20:47 +08:00
36 lines
1001 B
JavaScript
36 lines
1001 B
JavaScript
import React from 'react';
|
|
import {render} from 'react-dom';
|
|
import {ApolloProvider} from 'react-apollo';
|
|
|
|
import {client} from 'coral-framework/services/client';
|
|
import {checkLogin} from 'coral-framework/actions/auth';
|
|
import './graphql';
|
|
import {addExternalConfig} from 'coral-embed-stream/src/actions/config';
|
|
|
|
import reducers from './reducers';
|
|
import localStore, {injectReducers} from 'coral-framework/services/store';
|
|
import AppRouter from './AppRouter';
|
|
import {pym} from 'coral-framework';
|
|
|
|
injectReducers(reducers);
|
|
|
|
const store = (window.opener && window.opener.coralStore) ? window.opener.coralStore : localStore;
|
|
|
|
// Don't run this in the popup.
|
|
if (store === localStore) {
|
|
store.dispatch(checkLogin());
|
|
|
|
pym.sendMessage('getConfig');
|
|
|
|
pym.onMessage('config', (config) => {
|
|
store.dispatch(addExternalConfig(JSON.parse(config)));
|
|
});
|
|
}
|
|
|
|
render(
|
|
<ApolloProvider client={client} store={store}>
|
|
<AppRouter />
|
|
</ApolloProvider>
|
|
, document.querySelector('#coralStream')
|
|
);
|