From 41849654a7af5aa419f9365de8e66c658a74980d Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 2 Nov 2025 22:32:28 -0600 Subject: [PATCH] Refactor Sidebar organization actions: streamline default organization setting and deletion logic, ensuring proper error handling and UI consistency. --- apps/dokploy/components/layouts/side.tsx | 165 ++++++++++++----------- 1 file changed, 84 insertions(+), 81 deletions(-) diff --git a/apps/dokploy/components/layouts/side.tsx b/apps/dokploy/components/layouts/side.tsx index d2daaf6b2..8d84e260c 100644 --- a/apps/dokploy/components/layouts/side.tsx +++ b/apps/dokploy/components/layouts/side.tsx @@ -627,90 +627,93 @@ function SidebarLogo() { /> - {org.ownerId === session?.user?.id && ( -
- + {org.ownerId === session?.user?.id && ( + <> + + { + await deleteOrganization({ + organizationId: org.id, }) - .catch((error) => { - toast.error( - error?.message || - "Error setting default organization", - ); - }); - }} - title={ - isDefault - ? "Default organization" - : "Set as default" - } - > - {isDefault ? ( - - ) : ( - - )} - - - { - await deleteOrganization({ - organizationId: org.id, - }) - .then(() => { - refetch(); - toast.success( - "Organization deleted successfully", - ); - }) - .catch((error) => { - toast.error( - error?.message || - "Error deleting organization", - ); - }); - }} - > - - -
- )} + + + + )} + ); })}