summaryrefslogtreecommitdiff
path: root/src/store/modules/Operations/KeyClearStore.js
blob: e812ab23d3e3784bc7ee110e937e64b0f58ab30c (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
import api from '@/store/api';
import i18n from '@/i18n';

const KeyClearStore = {
  namespaced: true,
  actions: {
    async clearEncryptionKeys(_, selectedKey) {
      const selectedKeyForClearing = {
        Attributes: { hb_key_clear_request: selectedKey },
      };
      return await api
        .patch(
          `${await this.dispatch('global/getSystemPath')}/Bios/Settings`,
          selectedKeyForClearing,
        )
        .then(() =>
          i18n.global.t('pageKeyClear.toast.selectedKeyClearedSuccess'),
        )
        .catch((error) => {
          console.log('Key clear', error);
          throw new Error(
            i18n.global.t('pageKeyClear.toast.selectedKeyClearedError'),
          );
        });
    },
  },
};

export default KeyClearStore;