Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

feat: disable deleting team if only one team present

Marc Seitz4c6990e03fbb
diff --git a/components/teams/delete-team-modal.tsx b/components/teams/delete-team-modal.tsx
index 052124b8..ceb075a6 100644
--- a/components/teams/delete-team-modal.tsx
+++ b/components/teams/delete-team-modal.tsx
@@ -35,6 +35,11 @@ export function DeleteTeamModal({ children }: { children: React.ReactNode }) {
return;
}
+ if (teamInfo?.teams?.length === 1) {
+ toast.error("You cannot delete your only team");
+ return;
+ }
+
setLoading(true);
const response = await fetch(`/api/teams/${teamInfo?.currentTeam?.id}`, {
method: "DELETE",