Prevent users from deleting the last payment method attached to the org

This commit is contained in:
Carlos Monastyrski
2025-07-21 21:17:36 -03:00
parent 193bbf2bf3
commit b4ed1fa96a
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,