diff --git a/backend/src/services/certificate-profile/certificate-profile-service.ts b/backend/src/services/certificate-profile/certificate-profile-service.ts index 87063c6da..12e272ad6 100644 --- a/backend/src/services/certificate-profile/certificate-profile-service.ts +++ b/backend/src/services/certificate-profile/certificate-profile-service.ts @@ -213,7 +213,7 @@ export const certificateProfileServiceFactory = ({ throw new NotFoundError({ message: "Project not found" }); } const plan = await licenseService.getPlan(project.orgId); - if (!plan.pkiAcme) { + if (!plan.pkiAcme && data.enrollmentType === EnrollmentType.ACME) { throw new BadRequestError({ message: "Failed to create certificate profile: Plan restriction. Upgrade plan to continue" }); diff --git a/frontend/src/hooks/api/certificates/mutations.tsx b/frontend/src/hooks/api/certificates/mutations.tsx index a6daf0491..f65d6adc6 100644 --- a/frontend/src/hooks/api/certificates/mutations.tsx +++ b/frontend/src/hooks/api/certificates/mutations.tsx @@ -27,9 +27,18 @@ export const useDeleteCert = () => { ); return certificate; }, - onSuccess: (_, { projectSlug }) => { + onSuccess: (_, { projectId }) => { queryClient.invalidateQueries({ - queryKey: projectKeys.forProjectCertificates(projectSlug) + queryKey: ["certificate-profiles", "list"] + }); + queryClient.invalidateQueries({ + queryKey: pkiSubscriberKeys.allPkiSubscriberCertificates() + }); + queryClient.invalidateQueries({ + queryKey: projectKeys.allProjectCertificates() + }); + queryClient.invalidateQueries({ + queryKey: projectKeys.forProjectCertificates(projectId) }); } }); @@ -49,16 +58,18 @@ export const useRevokeCert = () => { ); return certificate; }, - onSuccess: (_, { projectSlug }) => { + onSuccess: (_, { projectId }) => { queryClient.invalidateQueries({ - queryKey: projectKeys.forProjectCertificates(projectSlug) + queryKey: ["certificate-profiles", "list"] }); queryClient.invalidateQueries({ queryKey: pkiSubscriberKeys.allPkiSubscriberCertificates() }); - queryClient.invalidateQueries({ - queryKey: ["certificate-profiles", "list"] + queryKey: projectKeys.allProjectCertificates() + }); + queryClient.invalidateQueries({ + queryKey: projectKeys.forProjectCertificates(projectId) }); } }); diff --git a/frontend/src/hooks/api/certificates/types.ts b/frontend/src/hooks/api/certificates/types.ts index 5e950b9c9..ee543aac7 100644 --- a/frontend/src/hooks/api/certificates/types.ts +++ b/frontend/src/hooks/api/certificates/types.ts @@ -24,12 +24,12 @@ export type TCertificate = { }; export type TDeleteCertDTO = { - projectSlug: string; + projectId: string; serialNumber: string; }; export type TRevokeCertDTO = { - projectSlug: string; + projectId: string; serialNumber: string; revocationReason: string; }; diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx index d9a564fb1..14e8d100a 100644 --- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx +++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx @@ -53,7 +53,7 @@ export const CertificateRevocationModal = ({ popUp, handlePopUpToggle }: Props) const { serialNumber } = popUp.revokeCertificate.data as { serialNumber: string }; await revokeCertificate({ - projectSlug: currentProject.slug, + projectId: currentProject.id, serialNumber, revocationReason }); diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx index 7ca9b81d0..e151df542 100644 --- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx +++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx @@ -42,7 +42,10 @@ export const CertificatesSection = () => { const onRemoveCertificateSubmit = async (serialNumber: string) => { if (!currentProject?.slug) return; - await deleteCert({ serialNumber, projectSlug: currentProject.slug }); + await deleteCert({ + serialNumber, + projectId: currentProject.id + }); createNotification({ text: "Successfully deleted certificate",