blob: 28ecc019833e7612af1c559a2ddb46db015145e9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { inject, observer } from 'mobx-react';
import { RouterStore } from 'mobx-react-router';
import ChangeServer from '../../components/auth/ChangeServer';
import SettingsStore from '../../stores/SettingsStore';
export default @inject('stores', 'actions') @observer class ChangeServerScreen extends Component {
constructor(props) {
super(props);
this.onSubmit = this.onSubmit.bind(this);
}
onSubmit(values) {
const { server } = values;
this.props.actions.settings.update({
type: 'app',
data: {
server,
},
});
this.props.stores.router.push('/auth');
}
render() {
const { stores } = this.props;
const { server } = stores.settings.all.app;
return (
<ChangeServer
onSubmit={this.onSubmit}
server={server}
/>
);
}
}
ChangeServerScreen.wrappedComponent.propTypes = {
actions: PropTypes.shape({
settings: PropTypes.instanceOf(SettingsStore).isRequired,
}).isRequired,
stores: PropTypes.shape({
settings: PropTypes.instanceOf(SettingsStore).isRequired,
router: PropTypes.instanceOf(RouterStore).isRequired,
}).isRequired,
};
|