blob: 1dc96e0ffcab21fe96b22841642a3dc711e6fc26 [file] [log] [blame]
Sandeepa Singh05887b52022-01-10 19:19:36 +05301import api from '@/store/api';
2import i18n from '@/i18n';
3
4const KeyClearStore = {
5 namespaced: true,
6 actions: {
7 async clearEncryptionKeys(_, selectedKey) {
8 const selectedKeyForClearing = {
9 Attributes: { hb_key_clear_request: selectedKey },
10 };
11 return await api
12 .patch(
13 '/redfish/v1/Systems/system/Bios/Settings',
14 selectedKeyForClearing
15 )
16 .then(() => i18n.t('pageKeyClear.toast.selectedKeyClearedSuccess'))
17 .catch((error) => {
18 console.log('Key clear', error);
19 throw new Error(i18n.t('pageKeyClear.toast.selectedKeyClearedError'));
20 });
21 },
22 },
23};
24
25export default KeyClearStore;