lml-main
Version:
This is now a mono repository published into many standalone packages.
25 lines • 983 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var actions_1 = require("../actions");
exports.PLACE_API_REDUCER_KEY = 'places';
exports.initialPlacesState = {
byId: {},
};
exports.placeApiReducer = function (state, action) {
if (state === void 0) { state = exports.initialPlacesState; }
switch (action.type) {
case actions_1.SET_PLACE_BY_ID:
return setPlaceById(state, action);
case actions_1.SET_PLACES:
return setPlaces(state, action);
default:
return state;
}
};
var setPlaceById = function (state, action) {
return (tslib_1.__assign({}, state, { byId: tslib_1.__assign({}, state.byId, (_a = {}, _a[action.place.placeId] = action.place, _a)) }));
var _a;
};
var setPlaces = function (state, action) { return (tslib_1.__assign({}, state, { byId: tslib_1.__assign({}, state.byId, action.places) })); };
//# sourceMappingURL=place.js.map