deleteTopic.js 836 B

12345678910111213141516171819202122232425262728293031323334
  1. import * as actionTypes from '../../../constants/admin';
  2. import initialState from '../../initialState';
  3. export default function deleteTopic(state = initialState.deleteTopic, {payload, type, error}) {
  4. switch (type) {
  5. case actionTypes.DELETE_TOPIC_REQUEST: {
  6. return {
  7. ...state,
  8. isFetching: true,
  9. payload
  10. }
  11. }
  12. case actionTypes.DELETE_TOPIC_REQUEST_SUCCESS: {
  13. return {
  14. ...state,
  15. isFetching: false,
  16. payload
  17. }
  18. }
  19. case actionTypes.DELETE_TOPIC_REQUEST_FAILURE: {
  20. return {
  21. ...state,
  22. isFetching: true,
  23. error
  24. }
  25. }
  26. default: {
  27. return state;
  28. }
  29. }
  30. }