From cdfa3e5a8fca1b3b8ed59881adcaa8c3d686de50 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 2 Feb 2023 11:41:55 -0800 Subject: Unified device selection --- modern/src/store/devices.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'modern/src/store/devices.js') diff --git a/modern/src/store/devices.js b/modern/src/store/devices.js index 9cfde0a8..1bae6d91 100644 --- a/modern/src/store/devices.js +++ b/modern/src/store/devices.js @@ -5,6 +5,7 @@ const { reducer, actions } = createSlice({ initialState: { items: {}, selectedId: null, + selectedIds: [], }, reducers: { refresh(state, action) { @@ -17,6 +18,14 @@ const { reducer, actions } = createSlice({ select(state, action) { state.selectedId = action.payload; }, + selectId(state, action) { + state.selectedId = action.payload; + state.selectedIds = [state.selectedId]; + }, + selectIds(state, action) { + state.selectedIds = action.payload; + [state.selectedId] = state.selectedIds; + }, remove(state, action) { delete state.items[action.payload]; }, -- cgit v1.2.3