summaryrefslogtreecommitdiff
path: root/src/store/modules/Operations/FactoryResetStore.js
blob: 83bddeb0347cd6e82db40036dceb4d4c76cae88f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import api from '@/store/api';
import i18n from '@/i18n';

const FactoryResetStore = {
  namespaced: true,
  actions: {
    async resetToDefaults() {
      return await api
        .post('/redfish/v1/Managers/bmc/Actions/Manager.ResetToDefaults', {
          ResetToDefaultsType: 'ResetAll',
        })
        .then(() => i18n.t('pageFactoryReset.toast.resetToDefaultsSuccess'))
        .catch((error) => {
          console.log('Factory Reset: ', error);
          throw new Error(
            i18n.t('pageFactoryReset.toast.resetToDefaultsError'),
          );
        });
    },
    async resetBios() {
      return await api
        .post('/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios')
        .then(() => i18n.t('pageFactoryReset.toast.resetBiosSuccess'))
        .catch((error) => {
          console.log('Factory Reset: ', error);
          throw new Error(i18n.t('pageFactoryReset.toast.resetBiosError'));
        });
    },
  },
};

export default FactoryResetStore;