|
@@ -1,19 +1,23 @@
|
|
import { createStore, combineRedusers, applyMiddleware } from 'redux';
|
|
import { createStore, combineRedusers, applyMiddleware } from 'redux';
|
|
import thunk from "redux-thunk";
|
|
import thunk from "redux-thunk";
|
|
|
|
|
|
-import { promiseReducer, localStoredReducer } from "./redusers";
|
|
|
|
|
|
+import { promiseReducer, localStoredReducer, totalReducer, authReducer } from "./reducers";
|
|
|
|
|
|
import { actionPending, actionFulfilled, actionRejected, actionPromise } from "./action";
|
|
import { actionPending, actionFulfilled, actionRejected, actionPromise } from "./action";
|
|
|
|
|
|
// объект со всеми редьюсерами
|
|
// объект со всеми редьюсерами
|
|
const reducers = {
|
|
const reducers = {
|
|
promise: localStoredReducer(promiseReducer, 'promise'),
|
|
promise: localStoredReducer(promiseReducer, 'promise'),
|
|
- // auth: localStoredReducer(authReducer, 'auth'),
|
|
|
|
|
|
+ auth: localStoredReducer(authReducer, 'auth'),
|
|
// cart: localStoredReducer(cartReducer, 'cart'),
|
|
// cart: localStoredReducer(cartReducer, 'cart'),
|
|
}
|
|
}
|
|
|
|
|
|
// const totalReducer = combineRedusers(reducers)
|
|
// const totalReducer = combineRedusers(reducers)
|
|
|
|
|
|
// создаем store для редьюсера
|
|
// создаем store для редьюсера
|
|
-export const store = createStore(promiseReducer, applyMiddleware(thunk))
|
|
|
|
|
|
+// export const store = createStore(promiseReducer, applyMiddleware(thunk))
|
|
|
|
+// store.subscribe(() => console.log(store.getState()))
|
|
|
|
+
|
|
|
|
+// 2 изменение
|
|
|
|
+export const store = createStore(totalReducer, applyMiddleware(thunk))
|
|
store.subscribe(() => console.log(store.getState()))
|
|
store.subscribe(() => console.log(store.getState()))
|