client/src/store/configureStore.js
changeset 59 1eb52770eefa
parent 58 f16a080e0bc4
child 62 b2514a9bcd49
--- a/client/src/store/configureStore.js	Mon Jun 19 21:37:33 2017 +0200
+++ b/client/src/store/configureStore.js	Mon Jun 19 21:46:21 2017 +0200
@@ -1,16 +1,11 @@
 import rootReducer from '../reducers';
 import rootSaga from '../sagas';
 import { loadSessions } from '../actions/sessionsActions';
-import { compose, createStore, applyMiddleware } from 'redux';
+import { createStore, applyMiddleware, compose } from 'redux';
 import { routerMiddleware } from 'react-router-redux';
 import handleTransitions from 'redux-history-transitions';
 import createSagaMiddleware from 'redux-saga'
 import Immutable from 'immutable';
-import { offline } from 'redux-offline';
-import offlineDefaultConfig from 'redux-offline/lib/defaults';
-import localForage from 'localforage';
-import immutableTransform from 'redux-persist-transform-immutable'
-import NoteRecord from './noteRecord'
 import APIClient from '../APIClient';
 import config from '../config';
 
@@ -18,7 +13,7 @@
 const currentUser = localStorage.getItem('currentUser');
 
 const defaultState = {
-//  currentSession: null,
+  currentSession: null,
   sessions: Immutable.List([]),
   notes: Immutable.List([]),
   isAuthenticated: token !== null,
@@ -31,23 +26,7 @@
   }
 };
 
-const immutableTransformConfig = {
-    records: [NoteRecord],
-    whitelist: ['sessions', 'notes']
-}
-
-const offlineConfig = {
-  ...offlineDefaultConfig,
-  persistOptions: {
-    storage: localForage,
-    transforms: [immutableTransform(immutableTransformConfig)]
-  },
-  detectNetwork: callback => callback(true),
-}
-
-//const storeInitialState = Immutable.Map(defaultState);
-//const storeInitialState = new Map(defaultState);
-const storeInitialState = defaultState;
+const storeInitialState = Immutable.Map(defaultState);
 
 export default (history, initialState = storeInitialState) => {
 
@@ -55,7 +34,7 @@
   const saga = createSagaMiddleware();
   const transitions = handleTransitions(history);
 
-  const store = offline(offlineConfig)(createStore)(rootReducer, initialState, compose(
+  const store = createStore(rootReducer, initialState, compose(
     applyMiddleware(router, saga),
     transitions
   ));
@@ -66,7 +45,7 @@
 
   saga.run(rootSaga, context);
 
-  //store.dispatch(loadSessions());
+  store.dispatch(loadSessions());
 
   return store;
 };