summaryrefslogtreecommitdiff
path: root/src/store/modules/HardwareStatus/SensorsStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/store/modules/HardwareStatus/SensorsStore.js')
-rw-r--r--src/store/modules/HardwareStatus/SensorsStore.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/store/modules/HardwareStatus/SensorsStore.js b/src/store/modules/HardwareStatus/SensorsStore.js
index 5a237bd4..32bf13b7 100644
--- a/src/store/modules/HardwareStatus/SensorsStore.js
+++ b/src/store/modules/HardwareStatus/SensorsStore.js
@@ -13,11 +13,15 @@ const SensorsStore = {
setSensors: (state, sensors) => {
state.sensors = uniqBy([...sensors, ...state.sensors], 'name');
},
+ setSensorsDefault: (state) => {
+ state.sensors = [];
+ },
},
actions: {
async getAllSensors({ dispatch }) {
const collection = await dispatch('getChassisCollection');
if (!collection) return;
+ dispatch('resetSensors');
const promises = collection.reduce((acc, id) => {
acc.push(dispatch('getSensors', id));
acc.push(dispatch('getThermalSensors', id));
@@ -34,6 +38,9 @@ const SensorsStore = {
)
.catch((error) => console.log(error));
},
+ async resetSensors({ commit }) {
+ commit('setSensorsDefault');
+ },
async getSensors({ commit }, id) {
const sensors = await api
.get(`${id}/Sensors`)