Skip to content

Instantly share code, notes, and snippets.

@mikevercoelen
Created January 30, 2018 09:24
Show Gist options
  • Save mikevercoelen/dd05d870dcdcd4ca6fe331c7d2a1563a to your computer and use it in GitHub Desktop.
Save mikevercoelen/dd05d870dcdcd4ca6fe331c7d2a1563a to your computer and use it in GitHub Desktop.
Login page module index.js example code
import { injectReducer } from 'common/reducers'
import * as Routes from 'constants/Routes'
import { toggleLoader } from 'common/actions/loader'
export default (store) => ({
path: Routes.LOGIN,
getComponent: async function (nextState, cb) {
store.dispatch(toggleLoader(true))
const [module, reducer] = await Promise.all([
import('./containers/LoginContainer'),
import('./reducers')
])
injectReducer(store, { key: 'login', reducer: reducer.default })
store.dispatch(toggleLoader(false))
cb(null, module.default)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment