1import api from '@/store/api';
2import i18n from '@/i18n';
3
4const FactoryResetStore = {
5  namespaced: true,
6  actions: {
7    async resetToDefaults() {
8      return await api
9        .post('/redfish/v1/Managers/bmc/Actions/Manager.ResetToDefaults', {
10          ResetToDefaultsType: 'ResetAll',
11        })
12        .then(() => i18n.t('pageFactoryReset.toast.resetToDefaultsSuccess'))
13        .catch((error) => {
14          console.log('Factory Reset: ', error);
15          throw new Error(
16            i18n.t('pageFactoryReset.toast.resetToDefaultsError')
17          );
18        });
19    },
20    async resetBios() {
21      return await api
22        .post('/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios')
23        .then(() => i18n.t('pageFactoryReset.toast.resetBiosSuccess'))
24        .catch((error) => {
25          console.log('Factory Reset: ', error);
26          throw new Error(i18n.t('pageFactoryReset.toast.resetBiosError'));
27        });
28    },
29  },
30};
31
32export default FactoryResetStore;
33