import api from '@/store/api'; const MotherboardStore = { namespaced: true, state: { motherboard: [], }, getters: { motherboard: (state) => state.motherboard, }, mutations: { setMotherboardDynamic: (state, data) => { state.motherboard = data; }, }, actions: { async getMotherboardDynamic({ commit }, { lastHour }) { let url = null; if (lastHour) { url = '/redfish/v1/TelemetryService/MetricReports/hour_data&id=other_temp&period=last_hour'; } else { url = '/redfish/v1/TelemetryService/MetricReports/hour_data&id=other_temp'; } return await api .get(url) .then(({ data: { MetricValues = [] } }) => commit('setMotherboardDynamic', MetricValues) ) .catch((error) => console.log(error)); }, }, }; export default MotherboardStore;