diff --git a/assets/index.html b/assets/index.html index 2151791..ae17e5a 100755 --- a/assets/index.html +++ b/assets/index.html @@ -11,7 +11,7 @@ - + diff --git a/package.json b/package.json index dd68a7a..df1ce4d 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "redux-persist": "^6.0.0", "redux-saga": "^1.1.1", "regenerator-runtime": "^0.13.3", + "reselect": "^4.0.0", "semantic-ui-css": "^2.4.1", "semantic-ui-react": "^0.88.2", "styled-components": "^4.4.0", diff --git a/src/containers/App/index.js b/src/containers/App/index.js index 15cffb1..382a619 100755 --- a/src/containers/App/index.js +++ b/src/containers/App/index.js @@ -5,6 +5,7 @@ import { Router, Switch, Route } from 'react-router-dom'; import { Helmet } from 'react-helmet-async'; import { Grid, Container, Header, Divider } from 'semantic-ui-react'; +import { getConfig } from './selectors'; import config from '../../config'; import history from '../../modules/history'; import Home from '../Home'; @@ -47,8 +48,7 @@ class App extends React.Component { } function mapStateToProps(state) { - // TODO: replace with selector here - return { loaded: !!state.app.config }; + return { loaded: !!getConfig(state) }; } function mapDispatchToProps(dispatch) { diff --git a/src/containers/App/selectors.js b/src/containers/App/selectors.js index 6fe1d8a..80a0cee 100644 --- a/src/containers/App/selectors.js +++ b/src/containers/App/selectors.js @@ -2,5 +2,10 @@ * The App state selectors */ -// import { createSelector } from 'reselect'; -// import { initialState } from './reducers'; +import { createSelector } from 'reselect'; + +export const getApp = state => state.app; + +export const getConfig = createSelector([getApp], app => { + return app.config; +}); diff --git a/yarn.lock b/yarn.lock index 53413e5..8c46801 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11756,6 +11756,11 @@ requires-port@^1.0.0: resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= +reselect@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/reselect/-/reselect-4.0.0.tgz#f2529830e5d3d0e021408b246a206ef4ea4437f7" + integrity sha512-qUgANli03jjAyGlnbYVAV5vvnOmJnODyABz51RdBN7M4WaVu8mecZWgyQNkG8Yqe3KRGRt0l4K4B3XVEULC4CA== + resolve-cwd@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a"