homeContentReducer.js
579 Bytes
import { FETCH_HOME_CONTENT_SUCCESS, FETCH_HOME_CONTENT_FAIL, CLEAR_ERRORS } from "../constants/homeContentConstants";
// Room details reducer.
export const homeContentReducer = (state = { homeContent: {} }, action) => {
switch (action.type) {
case FETCH_HOME_CONTENT_SUCCESS:
return {
homeContent: action.payload.data
};
case FETCH_HOME_CONTENT_FAIL:
return {
error: action.payload.error.message
};
case CLEAR_ERRORS:
return {
...state,
error: null
};
default:
return state;
}
};