diff options
Diffstat (limited to 'src/containers')
-rw-r--r-- | src/containers/auth/ChangeServerScreen.js | 50 | ||||
-rw-r--r-- | src/containers/auth/LoginScreen.js | 1 | ||||
-rw-r--r-- | src/containers/auth/SignupScreen.js | 1 | ||||
-rw-r--r-- | src/containers/auth/WelcomeScreen.js | 1 |
4 files changed, 53 insertions, 0 deletions
diff --git a/src/containers/auth/ChangeServerScreen.js b/src/containers/auth/ChangeServerScreen.js new file mode 100644 index 000000000..5c58087a3 --- /dev/null +++ b/src/containers/auth/ChangeServerScreen.js | |||
@@ -0,0 +1,50 @@ | |||
1 | import React, { Component } from 'react'; | ||
2 | import PropTypes from 'prop-types'; | ||
3 | import { inject, observer } from 'mobx-react'; | ||
4 | import { RouterStore } from 'mobx-react-router'; | ||
5 | import ChangeServer from '../../components/auth/ChangeServer'; | ||
6 | import SettingsStore from '../../stores/SettingsStore'; | ||
7 | |||
8 | export default @inject('stores', 'actions') @observer class ChangeServerScreen extends Component { | ||
9 | constructor(props) { | ||
10 | super(props); | ||
11 | |||
12 | this.onSubmit = this.onSubmit.bind(this); | ||
13 | } | ||
14 | |||
15 | onSubmit(values) { | ||
16 | const { server } = values; | ||
17 | |||
18 | this.props.actions.settings.update({ | ||
19 | type: 'app', | ||
20 | data: { | ||
21 | server, | ||
22 | }, | ||
23 | }); | ||
24 | this.props.stores.router.push('/auth'); | ||
25 | } | ||
26 | |||
27 | render() { | ||
28 | const { stores } = this.props; | ||
29 | const { server } = stores.settings.all.app; | ||
30 | |||
31 | return ( | ||
32 | <ChangeServer | ||
33 | onSubmit={this.onSubmit} | ||
34 | server={server} | ||
35 | /> | ||
36 | ); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | ChangeServerScreen.wrappedComponent.propTypes = { | ||
41 | actions: PropTypes.shape({ | ||
42 | settings: PropTypes.shape({ | ||
43 | update: PropTypes.func.isRequired, | ||
44 | }).isRequired, | ||
45 | }).isRequired, | ||
46 | stores: PropTypes.shape({ | ||
47 | settings: PropTypes.instanceOf(SettingsStore).isRequired, | ||
48 | router: PropTypes.instanceOf(RouterStore).isRequired, | ||
49 | }).isRequired, | ||
50 | }; | ||
diff --git a/src/containers/auth/LoginScreen.js b/src/containers/auth/LoginScreen.js index e5ee10785..d17820ad6 100644 --- a/src/containers/auth/LoginScreen.js +++ b/src/containers/auth/LoginScreen.js | |||
@@ -21,6 +21,7 @@ export default @inject('stores', 'actions') @observer class LoginScreen extends | |||
21 | isServerLogout={stores.user.logoutReason === stores.user.logoutReasonTypes.SERVER} | 21 | isServerLogout={stores.user.logoutReason === stores.user.logoutReasonTypes.SERVER} |
22 | signupRoute={stores.user.signupRoute} | 22 | signupRoute={stores.user.signupRoute} |
23 | passwordRoute={stores.user.passwordRoute} | 23 | passwordRoute={stores.user.passwordRoute} |
24 | changeServerRoute={stores.user.changeServerRoute} | ||
24 | error={error} | 25 | error={error} |
25 | /> | 26 | /> |
26 | ); | 27 | ); |
diff --git a/src/containers/auth/SignupScreen.js b/src/containers/auth/SignupScreen.js index f93498be2..803fe1cd9 100644 --- a/src/containers/auth/SignupScreen.js +++ b/src/containers/auth/SignupScreen.js | |||
@@ -36,6 +36,7 @@ export default @inject('stores', 'actions') @observer class SignupScreen extends | |||
36 | onSubmit={values => this.onSignup(values)} | 36 | onSubmit={values => this.onSignup(values)} |
37 | isSubmitting={stores.user.signupRequest.isExecuting} | 37 | isSubmitting={stores.user.signupRequest.isExecuting} |
38 | loginRoute={stores.user.loginRoute} | 38 | loginRoute={stores.user.loginRoute} |
39 | changeServerRoute={stores.user.changeServerRoute} | ||
39 | error={error} | 40 | error={error} |
40 | /> | 41 | /> |
41 | ); | 42 | ); |
diff --git a/src/containers/auth/WelcomeScreen.js b/src/containers/auth/WelcomeScreen.js index 75182345a..6f2d0eee6 100644 --- a/src/containers/auth/WelcomeScreen.js +++ b/src/containers/auth/WelcomeScreen.js | |||
@@ -14,6 +14,7 @@ export default @inject('stores', 'actions') @observer class LoginScreen extends | |||
14 | <Welcome | 14 | <Welcome |
15 | loginRoute={user.loginRoute} | 15 | loginRoute={user.loginRoute} |
16 | signupRoute={user.signupRoute} | 16 | signupRoute={user.signupRoute} |
17 | changeServerRoute={user.changeServerRoute} | ||
17 | recipes={recipePreviews.featured} | 18 | recipes={recipePreviews.featured} |
18 | /> | 19 | /> |
19 | ); | 20 | ); |