File tree Expand file tree Collapse file tree 6 files changed +14
-15
lines changed Expand file tree Collapse file tree 6 files changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,13 @@ import React, { Component } from 'react';
2
2
import PropTypes from 'prop-types' ;
3
3
import { provideHooks } from 'redial' ;
4
4
import { connect } from 'react-redux' ;
5
- import * as chatActions from 'redux/modules/chat' ;
5
+ import reducer , * as chatActions from 'redux/modules/chat' ;
6
6
import { withApp } from 'hoc' ;
7
7
8
8
@provideHooks ( {
9
- fetch : ( { store : { dispatch, getState } } ) => {
9
+ fetch : async ( { store : { dispatch, getState, inject } } ) => {
10
+ inject ( { chat : reducer } ) ;
11
+
10
12
const state = getState ( ) ;
11
13
12
14
if ( state . online ) {
Original file line number Diff line number Diff line change 1
1
import React , { Component } from 'react' ;
2
2
import PropTypes from 'prop-types' ;
3
+ import { provideHooks } from 'redial' ;
3
4
import { connect } from 'react-redux' ;
4
5
import Helmet from 'react-helmet' ;
5
6
import { initialize } from 'redux-form' ;
7
+ import reducer from 'redux/modules/survey' ;
6
8
import SurveyForm from 'components/SurveyForm/SurveyForm' ;
7
9
10
+ @provideHooks ( {
11
+ fetch : ( { store : { inject } } ) => inject ( { survey : reducer } )
12
+ } )
8
13
@connect ( ( ) => ( { } ) , { initialize } )
9
14
export default class Survey extends Component {
10
15
static propTypes = {
Original file line number Diff line number Diff line change @@ -3,13 +3,15 @@ import PropTypes from 'prop-types';
3
3
import Helmet from 'react-helmet' ;
4
4
import { provideHooks } from 'redial' ;
5
5
import { connect } from 'react-redux' ;
6
- import * as widgetActions from 'redux/modules/widgets' ;
6
+ import reducer , * as widgetActions from 'redux/modules/widgets' ;
7
7
import WidgetForm from 'components/WidgetForm/WidgetForm' ;
8
8
9
9
const { isLoaded, load : loadWidgets } = widgetActions ;
10
10
11
11
@provideHooks ( {
12
- defer : ( { store : { dispatch, getState } } ) => {
12
+ defer : ( { store : { dispatch, getState, inject } } ) => {
13
+ inject ( { widgets : reducer } ) ;
14
+
13
15
if ( ! isLoaded ( getState ( ) ) ) {
14
16
return dispatch ( loadWidgets ( ) ) . catch ( ( ) => null ) ;
15
17
}
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import createReducers from './reducer';
7
7
export function inject ( store , reducers ) {
8
8
Object . entries ( reducers ) . forEach ( ( [ name , reducer ] ) => {
9
9
if ( store . asyncReducers [ name ] ) return ;
10
- store . asyncReducers [ name ] = reducer ;
10
+ store . asyncReducers [ name ] = reducer . __esModule ? reducer . default : reducer ;
11
11
} ) ;
12
12
13
13
store . replaceReducer ( combineReducers ( createReducers ( store . asyncReducers ) ) ) ;
Original file line number Diff line number Diff line change @@ -5,9 +5,6 @@ import auth from './modules/auth';
5
5
import notifs from './modules/notifs' ;
6
6
import counter from './modules/counter' ;
7
7
import info from './modules/info' ;
8
- import widgets from './modules/widgets' ;
9
- import survey from './modules/survey' ;
10
- import chat from './modules/chat' ;
11
8
12
9
export default function createReducers ( asyncReducers ) {
13
10
return {
@@ -22,9 +19,6 @@ export default function createReducers(asyncReducers) {
22
19
counter3 : counter
23
20
} ) ,
24
21
info,
25
- widgets,
26
- survey,
27
- chat,
28
22
...asyncReducers
29
23
} ;
30
24
}
Original file line number Diff line number Diff line change @@ -4,8 +4,6 @@ import { routerActions } from 'react-router-redux';
4
4
import { connectedReduxRedirect } from 'redux-auth-wrapper/history4/redirect' ;
5
5
import { App , Home , NotFound } from 'containers' ;
6
6
7
- /* eslint-disable react/prop-types */
8
-
9
7
const About = Loadable ( {
10
8
loader : ( ) => import ( './containers/About/About' ) ,
11
9
loading : ( ) => < div > Loading</ div >
@@ -46,8 +44,6 @@ const Widgets = Loadable({
46
44
loading : ( ) => < div > Loading</ div >
47
45
} ) ;
48
46
49
- /* eslint-enable react/prop-types */
50
-
51
47
const isAuthenticated = connectedReduxRedirect ( {
52
48
redirectPath : '/login' ,
53
49
authenticatedSelector : state => state . auth . user !== null ,
You can’t perform that action at this time.
0 commit comments