diff options
Diffstat (limited to 'src/store/geofences.js')
-rw-r--r-- | src/store/geofences.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/store/geofences.js b/src/store/geofences.js new file mode 100644 index 00000000..f2b7666a --- /dev/null +++ b/src/store/geofences.js @@ -0,0 +1,20 @@ +import { createSlice } from '@reduxjs/toolkit'; + +const { reducer, actions } = createSlice({ + name: 'geofences', + initialState: { + items: {}, + }, + reducers: { + refresh(state, action) { + state.items = {}; + action.payload.forEach((item) => state.items[item.id] = item); + }, + update(state, action) { + action.payload.forEach((item) => state.items[item.id] = item); + }, + }, +}); + +export { actions as geofencesActions }; +export { reducer as geofencesReducer }; |