blob: 54faf5914f998993e88e3d14f192ae7be58e0043 [file] [log] [blame]
SurenNeware090c2d42020-04-01 14:07:27 +05301import api from '../../api';
2
3const ServerLedStore = {
4 namespaced: true,
5 state: {
6 indicatorValue: 'Off'
7 },
8 getters: {
9 getIndicatorValue: state => state.indicatorValue
10 },
11 mutations: {
12 setIndicatorValue(state, indicatorValue) {
13 state.indicatorValue = indicatorValue;
14 }
15 },
16 actions: {
SurenNewareaa7e8322020-06-12 17:59:34 +053017 async getIndicatorValue({ commit }) {
18 await api
SurenNeware090c2d42020-04-01 14:07:27 +053019 .get('/redfish/v1/Systems/system')
20 .then(response => {
21 commit('setIndicatorValue', response.data.IndicatorLED);
22 })
23 .catch(error => console.log(error));
24 },
SurenNewareaa7e8322020-06-12 17:59:34 +053025 async saveIndicatorLedValue({ commit }, payload) {
26 await api
SurenNeware090c2d42020-04-01 14:07:27 +053027 .patch('/redfish/v1/Systems/system', { IndicatorLED: payload })
28 .then(() => {
29 commit('setIndicatorValue', payload);
30 })
31 .catch(error => console.log(error));
32 }
33 }
34};
35
36export default ServerLedStore;