1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- import {applyMiddleware, combineReducers, createStore} from "redux";
- import {authReducer} from "./authReducer";
- import {promiseReducer,promiseWatcher} from "./promiseReducer";
- import {routeReducer, routeWatcher} from "./routeReducer";
- import {playerReducer} from "./playerReducer";
- import {loginWatcher,regWatcher} from "../actions/login-reg-actions";
- import {findMyTracksWatcher,playlistFindByOwnerWatcher} from "../actions/find-actions";
- import {setAvatarWatcher} from "../actions/set-avatar-actions";
- import {fullUploadPlaylistsWatcher,setTrackToPlaylistWatcher} from "../actions/my-playlist-tracks-actions";
- import {aboutMeWatcher,actionAboutMe} from "../actions/about-me-actions";
- import {fullUploadTrackWatcher} from "../actions/no-playlist-track-actions";
- import {localStoredReducer} from "./localStoredReducer";
- import createSagaMiddleware from 'redux-saga';
- import {all} from 'redux-saga/effects';
- import {createPlaylistWatcher} from "../actions/my-playlist-tracks-actions";
- // import {setUserPasswordWatcher} from "../pages/header/header-build";
- const sagaMiddleware = createSagaMiddleware()
- export const store = createStore(combineReducers({promise: localStoredReducer(promiseReducer, 'promise'),
- auth: localStoredReducer(authReducer, 'auth'),
- player: localStoredReducer(playerReducer, 'player'),
- route: localStoredReducer(routeReducer,'route')}),
- applyMiddleware(sagaMiddleware))
- // export const store = createStore(combineReducers({promise: promiseReducer,
- // auth: authReducer}),
- // applyMiddleware(sagaMiddleware))
- function* rootSaga(){
- yield all([
- promiseWatcher(),
- loginWatcher(),
- regWatcher(),
- setAvatarWatcher(),
- aboutMeWatcher(),
- createPlaylistWatcher(),
- findMyTracksWatcher(),
- routeWatcher(),
- playlistFindByOwnerWatcher(),
- setTrackToPlaylistWatcher(),
- fullUploadPlaylistsWatcher(),
- fullUploadTrackWatcher(),
- // setUserPasswordWatcher(),
- ])
- }
- store.dispatch(actionAboutMe())
- sagaMiddleware.run(rootSaga)
- store.subscribe(() => console.log(store.getState()))
|