SurenNeware | 090c2d4 | 2020-04-01 14:07:27 +0530 | [diff] [blame] | 1 | import api from '../../api'; |
| 2 | |
| 3 | const 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: { |
| 17 | getIndicatorValue: ({ commit }) => { |
| 18 | api |
| 19 | .get('/redfish/v1/Systems/system') |
| 20 | .then(response => { |
| 21 | commit('setIndicatorValue', response.data.IndicatorLED); |
| 22 | }) |
| 23 | .catch(error => console.log(error)); |
| 24 | }, |
| 25 | saveIndicatorLedValue: ({ commit }, payload) => { |
| 26 | api |
| 27 | .patch('/redfish/v1/Systems/system', { IndicatorLED: payload }) |
| 28 | .then(() => { |
| 29 | commit('setIndicatorValue', payload); |
| 30 | }) |
| 31 | .catch(error => console.log(error)); |
| 32 | } |
| 33 | } |
| 34 | }; |
| 35 | |
| 36 | export default ServerLedStore; |