camarasSlice is the core Redux slice that manages the camera catalog state. It provides reducers for filtering cameras by various criteria and resetting to the initial state.
Slice Configuration
The Redux slice name used in the store
Array of camera objects containing the complete IMOU camera catalog. Each camera includes:
id(number) - Unique camera identifiermarca(string) - Camera brand (e.g., “imou”)modelo(string) - Model number (e.g., “IPC-TA42P-D”)dimensiones(string) - Physical dimensionsvision nocturna(string) - Night vision capability (“Si” or “No”)camara inteligente(string) - Smart camera features (“Si” or “No”)descripcion(string) - Detailed product descriptiondiseño(string) - Design type (“Interior” or “Exterior”)resolucion(string) - Resolution (e.g., “2 mp”, “4 mp”, “5 mp”)conectividad(string) - Connectivity type (“Wifi”)tipo_de_camara(string) - Camera type (“Domo” or “Bullet”)imagenes(array) - Array of image URLs
Reducers
filterCamara
Filters the state to return a single camera by its ID.The camera ID to filter by
Returns an array containing only the camera matching the provided ID
filterModelo
Filters the state to return cameras matching a specific model number.The camera model string to filter by (e.g., “IPC-TA42P-D”)
Returns an array of cameras matching the specified model
filterCamarasAside
Applies multi-criteria filtering based on camera properties. This reducer handles both single and multiple filter values.Array of filter values to match against camera properties. Each value is capitalized and matched against all camera object values.
Returns cameras where all filter criteria match at least one property value
- Uses
capitalize()helper to normalize filter values - For single filter: Returns cameras where any property matches
- For multiple filters: Returns cameras where ALL filters match (AND logic)
- Utilizes
RTK.current()to access immutable state snapshots
backToInitialState
Resets the state to the original camera catalog.Returns a new array with all cameras from
initialStatereturnPreviousState
Internal reducer that callsbackToInitialState through case reducers.
This reducer invokes
camarasSlice.caseReducers.backToInitialState() internally.Store Integration
The slice is integrated into the Redux store under thecamaras key:
Exported Actions
The slice exports the following action creators:filterCamarafilterModelobackToInitialStatefilterCamarasAsidereturnPreviousState