diff --git a/docs/api-reference/redux.md b/docs/api-reference/redux.md index 930b041d5..61e4a68b3 100644 --- a/docs/api-reference/redux.md +++ b/docs/api-reference/redux.md @@ -54,6 +54,7 @@ Action to add a Layer to the store | --- | --- | --- | | id | string | unique id for the layer | | source | string | id of the source of the layer | +| layerAttributes | object | (optional) custom attributes to pass to the layer | ### updateLayer Action to update a Layer in the store @@ -61,14 +62,14 @@ Action to update a Layer in the store | Param | Type | Description | | --- | --- | --- | | id | string | unique id for the layer | -| layerAttributes | object | layer attributes to update (source, or other custom attributes) | +| layerAttributes | object | custom attributes to pass to the layer | ### removeLayer Action to remove a layer from the store | Param | Type | Description | | --- | --- | --- | -| layerId | string | id of the layer to remove | +| id | string | id of the layer to remove | ### setBaseMap Action to set a basemap diff --git a/src/redux/cartoSlice.js b/src/redux/cartoSlice.js index f3d0147da..c8b6cedec 100644 --- a/src/redux/cartoSlice.js +++ b/src/redux/cartoSlice.js @@ -128,21 +128,22 @@ export const removeSource = (sourceId) => ({ type: 'carto/removeSource', payload * Action to add a Layer to the store * @param {string} id - unique id for the layer * @param {string} source - id of the source of the layer + * @param {object} layerAttributes - custom attributes to pass to the layer */ -export const addLayer = ({id, source}) => ({ type: 'carto/addLayer', payload: {id, source} }); +export const addLayer = ({id, source, layerAttributes = {}}) => ({ type: 'carto/addLayer', payload: {id, source, layerAttributes} }); /** * Action to update a Layer in the store * @param {string} id - id of the layer to update * @param {object} layerAttributes - layer attributes to update (source, or other custom attributes) */ -export const updateLayer = (id, layerAttributes) => ({ type: 'carto/updateLayer', payload: {id, layerAttributes} }); +export const updateLayer = ({id, layerAttributes}) => ({ type: 'carto/updateLayer', payload: {id, layerAttributes} }); /** * Action to remove a layer from the store - * @param {string} layerId - id of the layer to remove + * @param {string} id - id of the layer to remove */ -export const removeLayer = (layerId) => ({ type: 'carto/removeLayer', payload: layerId}); +export const removeLayer = (id) => ({ type: 'carto/removeLayer', payload: id}); /** * Action to set a basemap