cpConnectPageReducer.js 599 Bytes
import { FETCH_CP_CONNECT_PAGE_SUCCESS, FETCH_CP_CONNECT_PAGE_FAIL, CLEAR_ERRORS } from "../constants/cpConnectPageConstants";

// Room details reducer.
export const cpConnectPageReducer = (state = { cpConnectPage: {} }, action) => {
  switch (action.type) {
    case FETCH_CP_CONNECT_PAGE_SUCCESS:
      return {
        cpConnectPage: action.payload.data
      };

    case FETCH_CP_CONNECT_PAGE_FAIL:
      return {
        error: action.payload.error.message
      };

    case CLEAR_ERRORS:
      return {
        ...state,
        error: null
      };

    default:
      return state;
  }
};