diff options
author | ditoaugusta <dt_ap@ymail.com> | 2020-03-24 15:04:52 +0700 |
---|---|---|
committer | ditoaugusta <dt_ap@ymail.com> | 2020-03-24 15:04:52 +0700 |
commit | 2f8ae58f4f5cde892b4b6981a83a37edc1422a2c (patch) | |
tree | f9354abc103d4dde4f98effbdf46739fefe4ac1f /modern/src/store/modules/positions.js | |
parent | 78d69f50595e058a08f3eaaa47fd7c3745fa1266 (diff) | |
download | trackermap-web-2f8ae58f4f5cde892b4b6981a83a37edc1422a2c.tar.gz trackermap-web-2f8ae58f4f5cde892b4b6981a83a37edc1422a2c.tar.bz2 trackermap-web-2f8ae58f4f5cde892b4b6981a83a37edc1422a2c.zip |
experiment: redux toolkit
Diffstat (limited to 'modern/src/store/modules/positions.js')
-rw-r--r-- | modern/src/store/modules/positions.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/modern/src/store/modules/positions.js b/modern/src/store/modules/positions.js new file mode 100644 index 00000000..1df468cd --- /dev/null +++ b/modern/src/store/modules/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 }; |