Put connect defaults into the state

This commit is contained in:
Ken-Håvard Lieng 2017-05-15 06:51:24 +02:00
parent ff7c563b61
commit d3a0a21338
2 changed files with 10 additions and 6 deletions

View File

@ -57,7 +57,7 @@ class Connect extends PureComponent {
};
render() {
const defaults = window.ENV.defaults;
const { defaults } = this.props;
let optionals = null;
if (this.state.showOptionals) {
@ -102,4 +102,10 @@ class Connect extends PureComponent {
}
}
export default connect()(Connect);
function mapStateToProps(state) {
return {
defaults: state.environment.get('connect_defaults')
};
}
export default connect(mapStateToProps)(Connect);

View File

@ -9,6 +9,7 @@ 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';
@ -21,10 +22,7 @@ handleSocket(socket, store);
const env = JSON.parse(document.getElementById('env').innerHTML);
// TODO: Handle this properly
window.ENV = {
defaults: env.defaults
};
store.dispatch(setEnvironment('connect_defaults', env.defaults));
if (env.servers) {
store.dispatch({