Merge pull request #4212 from Infisical/feat/blockLastPaymentMethodDelete

Prevent users from deleting the last payment method attached to the org
This commit is contained in:
carlosmonastyrski
2025-07-30 09:59:50 -03:00
committed by GitHub
2 changed files with 25 additions and 5 deletions
@@ -32,6 +32,13 @@ export const PmtMethodsTable = () => {
const handleDeletePmtMethodBtnClick = async () => {
if (!currentOrg?.id || !pmtMethodToRemove) return;
if (data?.length === 1) {
createNotification({
type: "error",
text: "You must have at least one payment method"
});
return;
}
try {
await deleteOrgPmtMethod.mutateAsync({
organizationId: currentOrg.id,