1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- import { createStore, combineReducers, applyMiddleware } from 'redux'
- import thunk from 'redux-thunk'
- import { promiseReducer } from './reducers/promise/promiseReducer'
- import { authReducer } from './reducers/auth/authReducer'
- import { myProfileReducer } from './reducers/myData/myProfileReducer'
- import { userProfileReducer } from './reducers/userData/userProfileReducer'
- import { feedReducer } from './reducers/feed/feedReducer'
- import { postReducer } from './reducers/post/postReducer'
- import { exploreReducer } from './reducers/explore/exploreReducer'
- import {
- promiseWatcher,
- fullProfilePageWatcher,
- loginWatcher,
- fullPageAboutUserWatcher,
- feedWatcher,
- exploreWatcher,
- onePostWatcher,
- addCommentFeedWatcher,
- addCommentOnePostWatcher,
- changeLikePostWatcher,
- editPostWatcher,
- changeSubscribeWatcher,
- userUpdateWatcher,
- setAvatarWatcher,
- clearAllDataWatcher,
- registerWatcher
- } from './saga'
- import createSagaMiddleware from 'redux-saga' //функция по созданию middleware
- import {
- all,
- put,
- takeEvery,
- takeLatest,
- takeLeading,
- select,
- } from 'redux-saga/effects' //
- const sagaMiddleware = createSagaMiddleware()
- export const store = createStore(
- combineReducers({
- promise: promiseReducer,
- auth: authReducer,
- myData: myProfileReducer,
- userData: userProfileReducer,
- feed: feedReducer,
- post: postReducer,
- explore: exploreReducer,
- }),
- applyMiddleware(sagaMiddleware),
- )
- function* rootSaga() {
- yield all([
- promiseWatcher(),
- fullProfilePageWatcher(),
- loginWatcher(),
- registerWatcher(),
- fullPageAboutUserWatcher(),
- feedWatcher(),
- exploreWatcher(),
- onePostWatcher(),
- addCommentOnePostWatcher(),
- changeLikePostWatcher(),
- editPostWatcher(),
- changeSubscribeWatcher(),
- userUpdateWatcher(),
- setAvatarWatcher(),
- clearAllDataWatcher()
- // addCommentFeedWatcher()
- ])
- }
- sagaMiddleware.run(rootSaga)
|