companyInformationReducer.js 635 Bytes
import { FETCH_COMPANY_INFORMATION_SUCCESS, FETCH_COMPANY_INFORMATION_FAIL, CLEAR_ERRORS } from "../constants/companyInformationConstants";

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

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

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

    default:
      return state;
  }
};