Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@
"errorAddCertificate": "Error adding certificate.",
"errorDeleteCertificate": "Error deleting certificate.",
"errorReplaceCertificate": "Error replacing certificate.",
"errorGenerateCsr": "Error generating CSR.",
"successAddCertificate": "Successfully added %{certificate}.",
"successAddedHTTPCertificate": "Successfully added %{certificate}. Reload the browser page to see the changes.",
"successDeleteCertificate": "Successfully deleted %{certificate}.",
Expand Down
7 changes: 6 additions & 1 deletion src/store/modules/SecurityAndAccess/CertificatesStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,12 @@ export const CertificatesStore = defineStore('certificates', {
)
//TODO: Success response also throws error so
// can't accurately show legitimate error in UI
.catch((error) => console.log(error));
.catch((error) => {
console.log(error);
throw new Error(
i18n.global.t('pageCertificates.toast.errorGenerateCsr')
);
});
},
},
});
Expand Down
18 changes: 12 additions & 6 deletions src/views/SecurityAndAccess/Certificates/ModalGenerateCsr.vue
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,14 @@ import { CertificatesStore } from '@/store';

import IconAdd from '@carbon/icons-vue/es/add--alt/20';

import useToast from '@/components/Composables/useToastComposable';
import { COUNTRY_LIST } from './CsrCountryCodes';
import { CERTIFICATE_TYPES } from '@/store/modules/SecurityAndAccess/CertificatesStore';
import useVuelidateComposable from '@/components/Composables/useVuelidateComposable';
import eventBus from '@/eventBus';

const { errorToast } = useToast();

const { getValidationState } = useVuelidateComposable();
const openCsrModal = ref(false);
const uploadCertificate = CertificatesStore();
Expand Down Expand Up @@ -432,12 +435,15 @@ const modal = ref(false);
const handleSubmit = () => {
v$.value.$touch();
if (v$.value.$invalid) return;
uploadCertificate.generateCsr(form.value).then(({ data: { CSRString } }) => {
csrString.value = CSRString;
modal.value = false;
openCsrModal.value = true;
v$.value.form.$reset();
});
uploadCertificate
.generateCsr(form.value)
.then(({ data: { CSRString } }) => {
csrString.value = CSRString;
modal.value = false;
openCsrModal.value = true;
v$.value.form.$reset();
})
.catch(({ message }) => errorToast(message));
};

const resetCsr = () => {
Expand Down