UNPKG

lml-main

Version:

This is now a mono repository published into many standalone packages.

24 lines 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const constants_1 = require("../../mapping/constants"); const actions_1 = require("../../mapping/actions"); const initialMapMarkersState = { markers: constants_1.MAP_FILTER_NAMES.reduce((acc, curr) => (Object.assign({}, acc, { [curr]: [] })), {}), polygons: {}, }; exports.mapMarkersReducer = (state = initialMapMarkersState, action) => { switch (action.type) { case actions_1.UPDATE_MARKERS: { return updateMarkers(state, action); } case actions_1.UPDATE_POLYGONS: { return updatePolygons(state, action); } default: { return state; } } }; const updateMarkers = (state, action) => (Object.assign({}, state, { markers: Object.assign({}, state.markers, { [action.markerType]: action.markers }) })); const updatePolygons = (state, action) => (Object.assign({}, state, { polygons: Object.assign({}, state.polygons, { [action.polygonType]: action.polygons }) })); //# sourceMappingURL=markers.js.map