summaryrefslogtreecommitdiff
path: root/src/store/modules/SecurityAndAccess/CertificatesStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/store/modules/SecurityAndAccess/CertificatesStore.js')
-rw-r--r--src/store/modules/SecurityAndAccess/CertificatesStore.js32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/store/modules/SecurityAndAccess/CertificatesStore.js b/src/store/modules/SecurityAndAccess/CertificatesStore.js
index 97241f34..3583d7f1 100644
--- a/src/store/modules/SecurityAndAccess/CertificatesStore.js
+++ b/src/store/modules/SecurityAndAccess/CertificatesStore.js
@@ -24,7 +24,7 @@ export const CERTIFICATE_TYPES = [
const getCertificateProp = (type, prop) => {
const certificate = CERTIFICATE_TYPES.find(
- (certificate) => certificate.type === type
+ (certificate) => certificate.type === type,
);
return certificate ? certificate[prop] : null;
};
@@ -51,12 +51,16 @@ const CertificatesStore = {
async getCertificates({ commit }) {
return await api
.get('/redfish/v1/CertificateService/CertificateLocations')
- .then(({ data: { Links: { Certificates } } }) =>
- Certificates.map((certificate) => certificate['@odata.id'])
+ .then(
+ ({
+ data: {
+ Links: { Certificates },
+ },
+ }) => Certificates.map((certificate) => certificate['@odata.id']),
)
.then((certificateLocations) => {
const promises = certificateLocations.map((location) =>
- api.get(location)
+ api.get(location),
);
api.all(promises).then(
api.spread((...responses) => {
@@ -82,12 +86,12 @@ const CertificatesStore = {
({ type }) =>
!certificates
.map((certificate) => certificate.type)
- .includes(type)
+ .includes(type),
);
commit('setCertificates', certificates);
commit('setAvailableUploadTypes', availableUploadTypes);
- })
+ }),
);
});
},
@@ -100,7 +104,7 @@ const CertificatesStore = {
.then(() =>
i18n.t('pageCertificates.toast.successAddCertificate', {
certificate: getCertificateProp(type, 'label'),
- })
+ }),
)
.catch((error) => {
console.log(error);
@@ -109,7 +113,7 @@ const CertificatesStore = {
},
async replaceCertificate(
{ dispatch },
- { certificateString, location, type }
+ { certificateString, location, type },
) {
const data = {};
data.CertificateString = certificateString;
@@ -119,18 +123,18 @@ const CertificatesStore = {
return await api
.post(
'/redfish/v1/CertificateService/Actions/CertificateService.ReplaceCertificate',
- data
+ data,
)
.then(() => dispatch('getCertificates'))
.then(() =>
i18n.t('pageCertificates.toast.successReplaceCertificate', {
certificate: getCertificateProp(type, 'label'),
- })
+ }),
)
.catch((error) => {
console.log(error);
throw new Error(
- i18n.t('pageCertificates.toast.errorReplaceCertificate')
+ i18n.t('pageCertificates.toast.errorReplaceCertificate'),
);
});
},
@@ -141,12 +145,12 @@ const CertificatesStore = {
.then(() =>
i18n.t('pageCertificates.toast.successDeleteCertificate', {
certificate: getCertificateProp(type, 'label'),
- })
+ }),
)
.catch((error) => {
console.log(error);
throw new Error(
- i18n.t('pageCertificates.toast.errorDeleteCertificate')
+ i18n.t('pageCertificates.toast.errorDeleteCertificate'),
);
});
},
@@ -190,7 +194,7 @@ const CertificatesStore = {
return await api
.post(
'/redfish/v1/CertificateService/Actions/CertificateService.GenerateCSR',
- data
+ data,
)
//TODO: Success response also throws error so
// can't accurately show legitimate error in UI