client/src/store/configureStore.js
changeset 100 6fd752d98933
parent 91 143ff08ec2cc
child 101 e165aa89ac82
equal deleted inserted replaced
99:18fa4a1fa9e9 100:6fd752d98933
     1 import rootReducer from '../reducers';
     1 import rootReducer from '../reducers';
     2 import rootAuthSaga from '../sagas/authSaga';
     2 import rootAuthSaga from '../sagas/authSaga';
       
     3 import rootGroupSaga from '../sagas/groupSaga';
     3 import networkSaga from '../sagas/networkSaga';
     4 import networkSaga from '../sagas/networkSaga';
     4 import { compose, createStore, applyMiddleware } from 'redux';
     5 import { compose, createStore, applyMiddleware } from 'redux';
     5 import { routerMiddleware } from 'react-router-redux';
     6 import { routerMiddleware } from 'react-router-redux';
     6 import createSagaMiddleware from 'redux-saga'
     7 import createSagaMiddleware from 'redux-saga'
     7 import Immutable from 'immutable';
     8 import Immutable from 'immutable';
    26 
    27 
    27 
    28 
    28 const defaultState = {
    29 const defaultState = {
    29   sessions: Immutable.List([]),
    30   sessions: Immutable.List([]),
    30   notes: Immutable.List([]),
    31   notes: Immutable.List([]),
       
    32   groups: Immutable.List([]),
    31   isAuthenticated: false,
    33   isAuthenticated: false,
    32   currentUser: null,
    34   currentUser: null,
    33   token: '',
    35   token: '',
    34   autoSubmit: false,
    36   autoSubmit: false,
    35   login: asyncRequest,
    37   login: asyncRequest,
    36   register: asyncRequest,
    38   register: asyncRequest,
       
    39   createGroup: asyncRequest
    37 };
    40 };
    38 
    41 
    39 const immutableTransformConfig = {
    42 const immutableTransformConfig = {
    40   records: [NoteRecord, SessionRecord, UserRecord],
    43   records: [NoteRecord, SessionRecord, UserRecord],
    41   whitelist: ['sessions', 'notes', 'currentUser']
    44   whitelist: ['sessions', 'notes', 'currentUser']
    75     client: apiClient,
    78     client: apiClient,
    76     history
    79     history
    77   }
    80   }
    78 
    81 
    79   saga.run(rootAuthSaga, context);
    82   saga.run(rootAuthSaga, context);
       
    83   saga.run(rootGroupSaga, context);
    80 
    84 
    81   store.dispatch(offlineConfigInitialized({ client: apiClient }))
    85   store.dispatch(offlineConfigInitialized({ client: apiClient }))
    82 
    86 
    83   return store;
    87   return store;
    84 };
    88 };