You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

archiveAdsReducer.js 626B

1234567891011121314151617181920212223242526272829303132
  1. import {
  2. FETCH_ARCHIVE_ADS_SUCCESS,
  3. FETCH_ARCHIVE_ADS_ERR,
  4. } from "../../actions/archiveAds/archiveAdsActionConstants";
  5. import createReducer from "../../utils/createReducer";
  6. const initialState = {
  7. archiveAds: [],
  8. errorMessage: "",
  9. };
  10. export default createReducer(
  11. {
  12. [FETCH_ARCHIVE_ADS_SUCCESS]: setStateArchiveAds,
  13. [FETCH_ARCHIVE_ADS_ERR]: setArchiveAdsError,
  14. },
  15. initialState
  16. );
  17. function setStateArchiveAds(state, action) {
  18. return {
  19. ...state,
  20. archiveAds: action.payload,
  21. };
  22. }
  23. function setArchiveAdsError(state, action) {
  24. return {
  25. ...state,
  26. errorMessage: action.payload,
  27. };
  28. }