Redux initial setup

This commit is contained in:
Sofiya Tepikin
2019-07-31 13:39:49 +02:00
parent 2d1ab273a0
commit 216a9044cd
4 changed files with 163 additions and 9 deletions
+22 -9
View File
@@ -9,6 +9,18 @@ import PasswordPrompt from './password-prompt'
import License from './license'
import AppLoadingView from './app-loading'
import { combineReducers } from 'redux'
import { configureStore } from 'redux-starter-kit'
import { Provider } from 'react-redux'
import dateReducer from '../slices/date'
const rootReducer = combineReducers({
dateReducer,
})
const store = configureStore({ reducer: rootReducer })
export default class AppWrapper extends Component {
constructor() {
super()
@@ -69,18 +81,19 @@ export default class AppWrapper extends Component {
shouldShowApp,
} = this.state
let initialView = null
if (isCheckingLicenseAgreement) {
return <AppLoadingView />
initialView = <AppLoadingView />
} else if (shouldShowLicenseAgreement) {
initialView = <License setLicense={this.disableShowLicenseAgreement}/>
} else if (shouldShowPasswordPrompt) {
initialView = <PasswordPrompt enableShowApp={this.enableShowApp} />
} else if (shouldShowApp) {
initialView = <App />
}
if (shouldShowLicenseAgreement) {
return <License setLicense={this.disableShowLicenseAgreement}/>
}
return <Provider store={store}>{initialView}</Provider>
if (shouldShowPasswordPrompt) {
return <PasswordPrompt enableShowApp={this.enableShowApp} />
}
return shouldShowApp && <App />
}
}