diff options
author | Stefan Malzner <stefan@adlk.io> | 2017-10-13 12:29:40 +0200 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2017-10-13 12:29:40 +0200 |
commit | 58cda9cc7fb79ca9df6746de7f9662bc08dc156a (patch) | |
tree | 1211600c2a5d3b5f81c435c6896618111a611720 /src/containers/auth/AuthLayoutContainer.js | |
download | ferdium-app-58cda9cc7fb79ca9df6746de7f9662bc08dc156a.tar.gz ferdium-app-58cda9cc7fb79ca9df6746de7f9662bc08dc156a.tar.zst ferdium-app-58cda9cc7fb79ca9df6746de7f9662bc08dc156a.zip |
initial commit
Diffstat (limited to 'src/containers/auth/AuthLayoutContainer.js')
-rw-r--r-- | src/containers/auth/AuthLayoutContainer.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/containers/auth/AuthLayoutContainer.js b/src/containers/auth/AuthLayoutContainer.js new file mode 100644 index 000000000..004054fdd --- /dev/null +++ b/src/containers/auth/AuthLayoutContainer.js | |||
@@ -0,0 +1,47 @@ | |||
1 | import React, { Component } from 'react'; | ||
2 | import PropTypes from 'prop-types'; | ||
3 | import { inject, observer } from 'mobx-react'; | ||
4 | |||
5 | import AuthLayout from '../../components/auth/AuthLayout'; | ||
6 | import AppStore from '../../stores/AppStore'; | ||
7 | import GlobalErrorStore from '../../stores/GlobalErrorStore'; | ||
8 | |||
9 | import { oneOrManyChildElements } from '../../prop-types'; | ||
10 | |||
11 | @inject('stores', 'actions') @observer | ||
12 | export default class AuthLayoutContainer extends Component { | ||
13 | static propTypes = { | ||
14 | children: oneOrManyChildElements.isRequired, | ||
15 | location: PropTypes.shape({ | ||
16 | pathname: PropTypes.string.isRequired, | ||
17 | }).isRequired, | ||
18 | }; | ||
19 | |||
20 | render() { | ||
21 | const { stores, actions, children, location } = this.props; | ||
22 | return ( | ||
23 | <AuthLayout | ||
24 | error={stores.globalError.response} | ||
25 | pathname={location.pathname} | ||
26 | isOnline={stores.app.isOnline} | ||
27 | isAPIHealthy={!stores.app.healthCheckRequest.isError} | ||
28 | retryHealthCheck={actions.app.healthCheck} | ||
29 | isHealthCheckLoading={stores.app.healthCheckRequest.isExecuting} | ||
30 | > | ||
31 | {children} | ||
32 | </AuthLayout> | ||
33 | ); | ||
34 | } | ||
35 | } | ||
36 | |||
37 | AuthLayoutContainer.wrappedComponent.propTypes = { | ||
38 | stores: PropTypes.shape({ | ||
39 | app: PropTypes.instanceOf(AppStore).isRequired, | ||
40 | globalError: PropTypes.instanceOf(GlobalErrorStore).isRequired, | ||
41 | }).isRequired, | ||
42 | actions: PropTypes.shape({ | ||
43 | app: PropTypes.shape({ | ||
44 | healthCheck: PropTypes.func.isRequired, | ||
45 | }).isRequired, | ||
46 | }).isRequired, | ||
47 | }; | ||