From 11bafca85ee2c3f4d4fac5f2ea6b874059099211 Mon Sep 17 00:00:00 2001 From: Yoshie Muranaka Date: Tue, 1 Dec 2020 16:38:47 -0800 Subject: Fix server LED switch value on error Add error state handling in the ServerLed store to make sure the UI accurately reflects the state if there is an error. Signed-off-by: Yoshie Muranaka Change-Id: I7f3647df9f5a32e241005eb7058a7cda1e0ba36a --- src/store/modules/Control/ServerLedStore.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/store') diff --git a/src/store/modules/Control/ServerLedStore.js b/src/store/modules/Control/ServerLedStore.js index d7c12344..a8903e2a 100644 --- a/src/store/modules/Control/ServerLedStore.js +++ b/src/store/modules/Control/ServerLedStore.js @@ -27,12 +27,12 @@ const ServerLedStore = { .catch((error) => console.log(error)); }, async saveIndicatorLedActiveState({ commit }, payload) { + commit('setIndicatorLedActiveState', payload); return await api .patch('/redfish/v1/Systems/system', { LocationIndicatorActive: payload, }) .then(() => { - commit('setIndicatorLedActiveState', payload); if (payload) { return i18n.t('pageServerLed.toast.successServerLedOn'); } else { @@ -41,6 +41,7 @@ const ServerLedStore = { }) .catch((error) => { console.log(error); + commit('setIndicatorLedActiveState', !payload); if (payload) { throw new Error(i18n.t('pageServerLed.toast.errorServerLedOn')); } else { -- cgit v1.2.3