1import 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;
26