Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

scheduleAppointmentReducer.js 952B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {
  2. SCHEDULE_APPOINTMENT_SUCCESS,
  3. SCHEDULE_APPOINTMENT_ERR,
  4. CLEAR_NOT_SENT_EMAILS_ARRAY,
  5. } from "../../actions/scheduleAppointment/scheduleAppointmentActionConstants";
  6. import createReducer from "../../utils/createReducer";
  7. const initialState = {
  8. notSentEmails: null,
  9. errorMessage: "",
  10. };
  11. export default createReducer(
  12. {
  13. [SCHEDULE_APPOINTMENT_SUCCESS]: setStateScheduleAppointment,
  14. [SCHEDULE_APPOINTMENT_ERR]: setScheduleAppointmentErrorMessage,
  15. [CLEAR_NOT_SENT_EMAILS_ARRAY]: setNotSentEmailsArrayNull,
  16. },
  17. initialState
  18. );
  19. function setStateScheduleAppointment(state, action) {
  20. return {
  21. ...state,
  22. notSentEmails: action.payload ? [...action.payload.notSentEmails] : null,
  23. };
  24. }
  25. function setScheduleAppointmentErrorMessage(state, action) {
  26. return {
  27. ...state,
  28. errorMessage: action.payload,
  29. };
  30. }
  31. function setNotSentEmailsArrayNull(state) {
  32. return {
  33. ...state,
  34. notSentEmails: null,
  35. };
  36. }