Sandeepa Singh | 05887b5 | 2022-01-10 19:19:36 +0530 | [diff] [blame] | 1 | import api from '@/store/api'; |
| 2 | import i18n from '@/i18n'; |
| 3 | |
| 4 | const 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( |
Sean Zhang | 8841b7d | 2024-06-15 08:42:41 +0300 | [diff] [blame] | 13 | `${await this.dispatch('global/getSystemPath')}/Bios/Settings`, |
Ed Tanous | 8132399 | 2024-02-27 11:26:24 -0800 | [diff] [blame] | 14 | selectedKeyForClearing, |
Sandeepa Singh | 05887b5 | 2022-01-10 19:19:36 +0530 | [diff] [blame] | 15 | ) |
Surya V | 603cfbf | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 16 | .then(() => |
| 17 | i18n.global.t('pageKeyClear.toast.selectedKeyClearedSuccess'), |
| 18 | ) |
Sandeepa Singh | 05887b5 | 2022-01-10 19:19:36 +0530 | [diff] [blame] | 19 | .catch((error) => { |
| 20 | console.log('Key clear', error); |
Surya V | 603cfbf | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 21 | throw new Error( |
| 22 | i18n.global.t('pageKeyClear.toast.selectedKeyClearedError'), |
| 23 | ); |
Sandeepa Singh | 05887b5 | 2022-01-10 19:19:36 +0530 | [diff] [blame] | 24 | }); |
| 25 | }, |
| 26 | }, |
| 27 | }; |
| 28 | |
| 29 | export default KeyClearStore; |