redux: initial

This commit is contained in:
muerwre 2018-11-26 10:38:21 +07:00
parent 0fcd0bd209
commit dca55a3bc4
6 changed files with 55 additions and 54 deletions

View file

@ -1,4 +1,4 @@
export const AUTH_ACTIONS = {
export const ACTIONS = {
};

View file

@ -1,5 +1,5 @@
import { createReducer } from 'reduxsauce';
import { AUTH_ACTIONS, EMPTY_USER } from '$redux/auth/constants';
import { ACTIONS, EMPTY_USER } from '$redux/auth/constants';
const HANDLERS = {

View file

@ -4,7 +4,7 @@ import { persistStore, persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage';
import createSagaMiddleware from 'redux-saga';
import createHistory from 'history/createBrowserHistory';
import { routerReducer, routerMiddleware } from 'react-router-redux';
// import { routerReducer, routerMiddleware } from 'react-router-redux';
import { authReducer } from '$redux/auth/reducer';
import { authSaga } from '$redux/auth/sagas';
@ -27,17 +27,20 @@ const composeEnhancers =
: compose;
/* eslint-enable no-underscore-dangle */
export const history = createHistory();
// export const history = createHistory();
export const store = createStore(
combineReducers({
auth: persistReducer(authPersistConfig, authReducer),
routing: routerReducer
// routing: routerReducer
}),
composeEnhancers(applyMiddleware(routerMiddleware(history), sagaMiddleware))
composeEnhancers(applyMiddleware(
// routerMiddleware(history),
sagaMiddleware
))
);
export default function configureStore() {
export function configureStore() {
// run sagas
sagaMiddleware.run(authSaga);