Guest User

Untitled

a guest
Nov 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. export function* downloadSeriesAsync(action) {
  2. try {
  3. let response = yield call(axios.get, '/content/series.json')
  4. yield put(downloadSeriesSuccess(response.data))
  5. }catch(e) {
  6. console.error(e);
  7. }
  8. }
  9.  
  10. yield put(downloadSeriesSuccess(response.data))
  11.  
  12. export default (state = [], action) => {
  13. console.log('Calling the with State', state);
  14. if (action.type === c.ADD_DOWNLOADED_SERIES) {
  15. let newState = { ...state };
  16. newState.series = [...newState.series, action.payload];
  17. return newState;
  18. }
  19. else {
  20. return state;
  21. }
  22. }
  23.  
  24. export default (initialState={}) => {
  25. console.log('Initial State', initialState);
  26. const sagaMiddleware = createSagaMiddleware();
  27. const all = applyMiddleware(sagaMiddleware, consoleLog)(createStore)(appReducer, initialState);
  28. sagaMiddleware.run(rootSaga);
  29. return all;
  30. }
Add Comment
Please, Sign In to add comment