diff options
author | Anton Tananaev <anton@traccar.org> | 2022-10-28 17:08:59 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-10-28 17:08:59 -0700 |
commit | 6a4eba7b63c84c20188b8a6b16f6107698bfde91 (patch) | |
tree | e486dbb32afadee5c2e2c7151d963871820eeb4f /modern/src/store | |
parent | 17b990eabe36138a4a879deef8d03b16ee27e1ba (diff) | |
download | trackermap-web-6a4eba7b63c84c20188b8a6b16f6107698bfde91.tar.gz trackermap-web-6a4eba7b63c84c20188b8a6b16f6107698bfde91.tar.bz2 trackermap-web-6a4eba7b63c84c20188b8a6b16f6107698bfde91.zip |
Move positions to session
Diffstat (limited to 'modern/src/store')
-rw-r--r-- | modern/src/store/index.js | 3 | ||||
-rw-r--r-- | modern/src/store/positions.js | 16 | ||||
-rw-r--r-- | modern/src/store/session.js | 4 |
3 files changed, 4 insertions, 19 deletions
diff --git a/modern/src/store/index.js b/modern/src/store/index.js index 71c0b2b8..0cc32d38 100644 --- a/modern/src/store/index.js +++ b/modern/src/store/index.js @@ -3,7 +3,6 @@ import { combineReducers, configureStore } from '@reduxjs/toolkit'; import { errorsReducer as errors } from './errors'; import { sessionReducer as session } from './session'; import { devicesReducer as devices } from './devices'; -import { positionsReducer as positions } from './positions'; import { eventsReducer as events } from './events'; import { geofencesReducer as geofences } from './geofences'; import { groupsReducer as groups } from './groups'; @@ -16,7 +15,6 @@ const reducer = combineReducers({ errors, session, devices, - positions, events, geofences, groups, @@ -28,7 +26,6 @@ const reducer = combineReducers({ export { errorsActions } from './errors'; export { sessionActions } from './session'; export { devicesActions } from './devices'; -export { positionsActions } from './positions'; export { eventsActions } from './events'; export { geofencesActions } from './geofences'; export { groupsActions } from './groups'; diff --git a/modern/src/store/positions.js b/modern/src/store/positions.js deleted file mode 100644 index 8858298d..00000000 --- a/modern/src/store/positions.js +++ /dev/null @@ -1,16 +0,0 @@ -import { createSlice } from '@reduxjs/toolkit'; - -const { reducer, actions } = createSlice({ - name: 'positions', - initialState: { - items: {}, - }, - reducers: { - update(state, action) { - action.payload.forEach((item) => state.items[item.deviceId] = item); - }, - }, -}); - -export { actions as positionsActions }; -export { reducer as positionsReducer }; diff --git a/modern/src/store/session.js b/modern/src/store/session.js index 88d1eb44..74dc29a0 100644 --- a/modern/src/store/session.js +++ b/modern/src/store/session.js @@ -6,6 +6,7 @@ const { reducer, actions } = createSlice({ server: null, user: null, socket: null, + positions: {}, }, reducers: { updateServer(state, action) { @@ -17,6 +18,9 @@ const { reducer, actions } = createSlice({ updateSocket(state, action) { state.socket = action.payload; }, + updatePositions(state, action) { + action.payload.forEach((position) => state.positions[position.deviceId] = position); + }, }, }); |