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
@@ -29,44 +29,29 @@ export const CaSection = () => {
] as const);
const onRemoveCaSubmit = async (caName: string) => {
try {
if (!currentProject?.slug) return;
if (!currentProject?.slug) return;
await deleteCa({ caName, projectId: currentProject.id, type: CaType.INTERNAL });
await deleteCa({ caName, projectId: currentProject.id, type: CaType.INTERNAL });
createNotification({
text: "Successfully deleted CA",
type: "success"
});
createNotification({
text: "Successfully deleted CA",
type: "success"
});
handlePopUpClose("deleteCa");
} catch {
createNotification({
text: "Failed to delete CA",
type: "error"
});
}
handlePopUpClose("deleteCa");
};
const onUpdateCaStatus = async ({ caName, status }: { caName: string; status: CaStatus }) => {
try {
if (!currentProject?.slug) return;
if (!currentProject?.slug) return;
await updateCa({ caName, projectId: currentProject.id, type: CaType.INTERNAL, status });
await updateCa({ caName, projectId: currentProject.id, type: CaType.INTERNAL, status });
createNotification({
text: `Successfully ${status === CaStatus.ACTIVE ? "enabled" : "disabled"} CA`,
type: "success"
});
createNotification({
text: `Successfully ${status === CaStatus.ACTIVE ? "enabled" : "disabled"} CA`,
type: "success"
});
handlePopUpClose("caStatus");
} catch (err) {
console.error(err);
createNotification({
text: `Failed to ${status === CaStatus.ACTIVE ? "enabled" : "disabled"} CA`,
type: "error"
});
}
handlePopUpClose("caStatus");
};
return (