aboutsummaryrefslogtreecommitdiff
path: root/modern/src/store
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-04-19 09:34:28 -0700
committerGitHub <noreply@github.com>2021-04-19 09:34:28 -0700
commit047bf86480e2b3e215c13df2af0da456a664b507 (patch)
tree9edd2ceef5a1a381d416a1b03f529b0088c559a7 /modern/src/store
parent2de99a83b3c45bc15faed44a1b248d56698b292b (diff)
parent2691e78cd4d5486581656a490b9fb5386e68a5d9 (diff)
downloadtrackermap-web-047bf86480e2b3e215c13df2af0da456a664b507.tar.gz
trackermap-web-047bf86480e2b3e215c13df2af0da456a664b507.tar.bz2
trackermap-web-047bf86480e2b3e215c13df2af0da456a664b507.zip
Merge pull request #839 from mail2bishnoi/event_type_convsersion
Event type Localization and geofence store creation
Diffstat (limited to 'modern/src/store')
-rw-r--r--modern/src/store/geofences.js16
-rw-r--r--modern/src/store/index.js3
2 files changed, 19 insertions, 0 deletions
diff --git a/modern/src/store/geofences.js b/modern/src/store/geofences.js
new file mode 100644
index 00000000..c5e58147
--- /dev/null
+++ b/modern/src/store/geofences.js
@@ -0,0 +1,16 @@
+import { createSlice } from '@reduxjs/toolkit';
+
+const { reducer, actions } = createSlice({
+ name: 'geofences',
+ initialState: {
+ items: {},
+ },
+ reducers: {
+ update(state, action) {
+ action.payload.forEach(item => state.items[item['id']] = item);
+ },
+ }
+});
+
+export { actions as geofencesActions };
+export { reducer as geofencesReducer };
diff --git a/modern/src/store/index.js b/modern/src/store/index.js
index 432ef78e..1fddae99 100644
--- a/modern/src/store/index.js
+++ b/modern/src/store/index.js
@@ -3,15 +3,18 @@ import { combineReducers, configureStore } from '@reduxjs/toolkit';
import { sessionReducer as session } from './session';
import { devicesReducer as devices } from './devices';
import { positionsReducer as positions } from './positions';
+import { geofencesReducer as geofences } from './geofences';
const reducer = combineReducers({
session,
devices,
positions,
+ geofences,
});
export { sessionActions } from './session';
export { devicesActions } from './devices';
export { positionsActions } from './positions';
+export { geofencesActions } from './geofences';
export default configureStore({ reducer });