xref: /openbmc/webui-vue/src/store/modules/Operations/KeyClearStore.js (revision 2f2f64d2f6a2daf8a8b6c42d5e04e184d22642d5)
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