Add document title handling
This commit is contained in:
parent
511b9e406c
commit
2afbf2359c
8 changed files with 156 additions and 65 deletions
|
@ -4,55 +4,18 @@ import { AppContainer } from 'react-hot-loader';
|
|||
import 'react-virtualized/styles.css';
|
||||
|
||||
import configureStore from './store';
|
||||
import initRouter, { replace } from './util/router';
|
||||
import initRouter from './util/router';
|
||||
import routes from './routes';
|
||||
import Socket from './util/Socket';
|
||||
import handleSocket from './socket';
|
||||
import Root from './containers/Root';
|
||||
import { setEnvironment } from './actions/environment';
|
||||
import { addMessages } from './actions/message';
|
||||
import { initWidthUpdates } from './util/messageHeight';
|
||||
import runModules from './modules';
|
||||
|
||||
const host = DEV ? `${window.location.hostname}:1337` : window.location.host;
|
||||
const socket = new Socket(host);
|
||||
|
||||
const store = configureStore(socket);
|
||||
|
||||
initRouter(routes, store);
|
||||
handleSocket(socket, store);
|
||||
|
||||
const env = JSON.parse(document.getElementById('env').innerHTML);
|
||||
|
||||
store.dispatch(setEnvironment('connect_defaults', env.defaults));
|
||||
|
||||
if (env.servers) {
|
||||
store.dispatch({
|
||||
type: 'SOCKET_SERVERS',
|
||||
data: env.servers
|
||||
});
|
||||
} else {
|
||||
store.dispatch(replace('/connect'));
|
||||
}
|
||||
|
||||
if (env.channels) {
|
||||
store.dispatch({
|
||||
type: 'SOCKET_CHANNELS',
|
||||
data: env.channels
|
||||
});
|
||||
}
|
||||
|
||||
if (env.users) {
|
||||
store.dispatch({
|
||||
type: 'SOCKET_USERS',
|
||||
...env.users
|
||||
});
|
||||
}
|
||||
|
||||
initWidthUpdates(store, () => {
|
||||
if (env.messages) {
|
||||
const { messages, server, to, next } = env.messages;
|
||||
store.dispatch(addMessages(messages, server, to, false, next));
|
||||
}
|
||||
});
|
||||
runModules({ store, socket });
|
||||
|
||||
const renderRoot = () => {
|
||||
render(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue