diff options
author | ditoaugusta <dt_ap@ymail.com> | 2020-03-25 00:24:33 +0700 |
---|---|---|
committer | ditoaugusta <dt_ap@ymail.com> | 2020-03-25 00:24:33 +0700 |
commit | 506fe663e2e3b9ffe9764f5c06b04524c4793534 (patch) | |
tree | 592318f13ce3d2e66294d95bb2b603cd20b43735 /modern/src/store/devices.js | |
parent | 2f8ae58f4f5cde892b4b6981a83a37edc1422a2c (diff) | |
download | trackermap-web-506fe663e2e3b9ffe9764f5c06b04524c4793534.tar.gz trackermap-web-506fe663e2e3b9ffe9764f5c06b04524c4793534.tar.bz2 trackermap-web-506fe663e2e3b9ffe9764f5c06b04524c4793534.zip |
delete module subfolder. edit relative path.
Diffstat (limited to 'modern/src/store/devices.js')
-rw-r--r-- | modern/src/store/devices.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/modern/src/store/devices.js b/modern/src/store/devices.js new file mode 100644 index 00000000..0d96e98d --- /dev/null +++ b/modern/src/store/devices.js @@ -0,0 +1,20 @@ +import { createSlice } from '@reduxjs/toolkit'; + +const { reducer, actions } = createSlice({ + name: 'devices', + initialState: { + items: {}, + selectedId: null + }, + reducers: { + update(state, action) { + action.payload.forEach(item => state.items[item['id']] = item); + }, + select(state, action) { + state.selectedId = action.payload.id; + } + } +}); + +export { actions as devicesActions }; +export { reducer as devicesReducer }; |