import { FETCH_LOCATIONS_SUCCESS, FETCH_LOCATIONS_FAIL, CLEAR_ERRORS } from "../constants/locationsConstants"; // Room details reducer. export const locationsReducer = (state = { locations: [] }, action) => { switch (action.type) { case FETCH_LOCATIONS_SUCCESS: return { locations: action.payload.data }; case FETCH_LOCATIONS_FAIL: return { error: action.payload.error.message }; case CLEAR_ERRORS: return { ...state, error: null }; default: return state; } };