aboutsummaryrefslogtreecommitdiff
path: root/modern/src/store/positions.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-03-25 00:31:37 -0700
committerGitHub <noreply@github.com>2020-03-25 00:31:37 -0700
commitb10607f96ad72f5f971fbd867eeeeb86380f79cb (patch)
tree81b7a13c0c3fc4da12182ee20518f021406def9b /modern/src/store/positions.js
parent78d69f50595e058a08f3eaaa47fd7c3745fa1266 (diff)
parent37f8b1cd81614ed9281647b326a30d58123c5942 (diff)
downloadtrackermap-web-b10607f96ad72f5f971fbd867eeeeb86380f79cb.tar.gz
trackermap-web-b10607f96ad72f5f971fbd867eeeeb86380f79cb.tar.bz2
trackermap-web-b10607f96ad72f5f971fbd867eeeeb86380f79cb.zip
Merge pull request #772 from dt-ap/experiment/redux-toolkit
Experimental: Use Redux Toolkit
Diffstat (limited to 'modern/src/store/positions.js')
-rw-r--r--modern/src/store/positions.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/modern/src/store/positions.js b/modern/src/store/positions.js
new file mode 100644
index 00000000..1df468cd
--- /dev/null
+++ b/modern/src/store/positions.js
@@ -0,0 +1,16 @@
+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 };