aboutsummaryrefslogtreecommitdiff
path: root/modern/src/store/devices.js
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2021-12-13 22:46:41 -0600
committerIván Ávalos <avalos@disroot.org>2021-12-13 22:46:41 -0600
commit90cc5be085b9716347e619929782398803d77c9a (patch)
tree6f9bfd1dfe95425e126d55b727aa6de2cd0b52bc /modern/src/store/devices.js
parentef46ac4ed003781c19ceda22998160e6dd06a6bb (diff)
downloadetbsa-traccar-web-90cc5be085b9716347e619929782398803d77c9a.tar.gz
etbsa-traccar-web-90cc5be085b9716347e619929782398803d77c9a.tar.bz2
etbsa-traccar-web-90cc5be085b9716347e619929782398803d77c9a.zip
Made improvements to search and other things
Diffstat (limited to 'modern/src/store/devices.js')
-rw-r--r--modern/src/store/devices.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/modern/src/store/devices.js b/modern/src/store/devices.js
index bb9068f..f63602a 100644
--- a/modern/src/store/devices.js
+++ b/modern/src/store/devices.js
@@ -4,6 +4,7 @@ const { reducer, actions } = createSlice({
name: 'devices',
initialState: {
items: {},
+ filterTerm: '',
filteredItems: {},
selectedId: null,
},
@@ -22,12 +23,14 @@ const { reducer, actions } = createSlice({
state.selectedId = null;
},
setFilter(state, action) {
+ state.filterTerm = action.payload;
const items = Object.entries(current(state).items);
state.filteredItems = Object.fromEntries(items.filter(([k, v]) => {
return v.name.toLowerCase().includes(action.payload.toLowerCase());
}));
},
clearFilter(state, action) {
+ state.filterTerm = '';
state.filteredItems = {};
},
remove(state, action) {