refactor: streamline modal close handlers and completion callbacks across various components

This commit is contained in:
Victor Santos
2025-10-31 18:43:34 -03:00
parent 7d8b28367e
commit b26fb73053
116 changed files with 1865 additions and 2949 deletions
@@ -51,30 +51,22 @@ const Page = () => {
] as const);
const onRemoveSubscriberSubmit = async (subscriberNameToDelete: string) => {
try {
if (!projectId) return;
if (!projectId) return;
await deletePkiSubscriber({ subscriberName: subscriberNameToDelete, projectId });
await deletePkiSubscriber({ subscriberName: subscriberNameToDelete, projectId });
createNotification({
text: "Successfully deleted subscriber",
type: "success"
});
createNotification({
text: "Successfully deleted subscriber",
type: "success"
});
handlePopUpClose("deletePkiSubscriber");
navigate({
to: "/projects/cert-management/$projectId/subscribers",
params: {
projectId
}
});
} catch (err) {
console.error(err);
createNotification({
text: "Failed to delete subscriber",
type: "error"
});
}
handlePopUpClose("deletePkiSubscriber");
navigate({
to: "/projects/cert-management/$projectId/subscribers",
params: {
projectId
}
});
};
return (
@@ -70,36 +70,28 @@ export const PkiSubscriberDetailsSection = ({ subscriberName, handlePopUpOpen }:
useOrderPkiSubscriberCert();
const onIssuePkiSubscriberCert = async () => {
try {
if (pkiSubscriber?.supportsImmediateCertIssuance) {
const response = await issuePkiSubscriberCert({ subscriberName, projectId });
if (pkiSubscriber?.supportsImmediateCertIssuance) {
const response = await issuePkiSubscriberCert({ subscriberName, projectId });
setCertificateDetails({
serialNumber: response.serialNumber,
certificate: response.certificate,
certificateChain: response.certificateChain,
privateKey: response.privateKey
});
setCertificateDetails({
serialNumber: response.serialNumber,
certificate: response.certificate,
certificateChain: response.certificateChain,
privateKey: response.privateKey
});
setIsModalOpen(true);
setIsModalOpen(true);
createNotification({
text: "Successfully issued certificate",
type: "success"
});
} else {
await orderPkiSubscriberCert({ subscriberName, projectId });
createNotification({
text: "Successfully ordered certificate. It will be issued after CA processing which could take a few minutes.",
type: "info"
});
}
} catch (err) {
console.error(err);
createNotification({
text: "Failed to issue certificate",
type: "error"
text: "Successfully issued certificate",
type: "success"
});
} else {
await orderPkiSubscriberCert({ subscriberName, projectId });
createNotification({
text: "Successfully ordered certificate. It will be issued after CA processing which could take a few minutes.",
type: "info"
});
}
};