blob: 45a06adbc9eb8aa4eabd4672fb02c6c37679d380 [file] [log] [blame]
import api from '../../api';
const PowerCapStore = {
namespaced: true,
state: {
powerCapData: false
},
getters: {
powerCapData: state => state.powerCapData
},
mutations: {
setPowerCapData: (state, powerCapData) =>
(state.powerCapData = powerCapData)
},
actions: {
getPowerCapData({ commit }) {
api
.get('/xyz/openbmc_project/control/host0/power_cap')
.then(response => {
const powerCapData = response.data.data;
if (powerCapData.PowerCapEnable) {
commit('setPowerCapData', powerCapData.PowerCap);
}
})
.catch(error => {
console.log('Power cap error', error);
});
}
}
};
export default PowerCapStore;