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
|
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { inject, observer } from 'mobx-react';
import AuthLayout from '../../components/auth/AuthLayout';
import AppStore from '../../stores/AppStore';
import GlobalErrorStore from '../../stores/GlobalErrorStore';
import { oneOrManyChildElements } from '../../prop-types';
export default @inject('stores', 'actions') @observer class AuthLayoutContainer extends Component {
static propTypes = {
children: oneOrManyChildElements.isRequired,
location: PropTypes.shape({
pathname: PropTypes.string.isRequired,
}).isRequired,
};
render() {
const { stores, actions, children, location } = this.props;
return (
<AuthLayout
error={stores.globalError.response}
pathname={location.pathname}
isOnline={stores.app.isOnline}
isAPIHealthy={!stores.app.healthCheckRequest.isError}
retryHealthCheck={actions.app.healthCheck}
isHealthCheckLoading={stores.app.healthCheckRequest.isExecuting}
darkMode={stores.app.isSystemDarkModeEnabled}
>
{children}
</AuthLayout>
);
}
}
AuthLayoutContainer.wrappedComponent.propTypes = {
stores: PropTypes.shape({
app: PropTypes.instanceOf(AppStore).isRequired,
globalError: PropTypes.instanceOf(GlobalErrorStore).isRequired,
}).isRequired,
actions: PropTypes.shape({
app: PropTypes.shape({
healthCheck: PropTypes.func.isRequired,
}).isRequired,
}).isRequired,
};
|