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( 10 `${await this.dispatch('global/getBmcPath')}/Actions/Manager.ResetToDefaults`, 11 { 12 ResetType: 'ResetAll', 13 }, 14 ) 15 .then(() => i18n.t('pageFactoryReset.toast.resetToDefaultsSuccess')) 16 .catch((error) => { 17 console.log('Factory Reset: ', error); 18 throw new Error( 19 i18n.t('pageFactoryReset.toast.resetToDefaultsError'), 20 ); 21 }); 22 }, 23 async resetBios() { 24 return await api 25 .post( 26 `${await this.dispatch('global/getSystemPath')}/Bios/Actions/Bios.ResetBios`, 27 ) 28 .then(() => i18n.t('pageFactoryReset.toast.resetBiosSuccess')) 29 .catch((error) => { 30 console.log('Factory Reset: ', error); 31 throw new Error(i18n.t('pageFactoryReset.toast.resetBiosError')); 32 }); 33 }, 34 }, 35}; 36 37export default FactoryResetStore; 38