From 7e05bc86a994a95062393fe1da5a3da8e848c2bd Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Wed, 14 May 2025 08:58:29 -0700 Subject: [PATCH] improvement: address feedback --- .../components/DuplicateOrgRoleModal.tsx | 36 ++++++++---------- .../components/DuplicateProjectRoleModal.tsx | 38 +++++++++---------- 2 files changed, 33 insertions(+), 41 deletions(-) diff --git a/frontend/src/pages/organization/RoleByIDPage/components/DuplicateOrgRoleModal.tsx b/frontend/src/pages/organization/RoleByIDPage/components/DuplicateOrgRoleModal.tsx index ca68a6bb1..8995c03b3 100644 --- a/frontend/src/pages/organization/RoleByIDPage/components/DuplicateOrgRoleModal.tsx +++ b/frontend/src/pages/organization/RoleByIDPage/components/DuplicateOrgRoleModal.tsx @@ -47,29 +47,25 @@ const Content = ({ role, onClose }: ContentProps) => { const navigate = useNavigate(); const handleDuplicateRole = async (form: FormData) => { - try { - const newRole = await createRole.mutateAsync({ - orgId: role.orgId, - permissions: role.permissions, - ...form - }); + const newRole = await createRole.mutateAsync({ + orgId: role.orgId, + permissions: role.permissions, + ...form + }); - createNotification({ - type: "success", - text: "Role duplicated successfully" - }); + createNotification({ + type: "success", + text: "Role duplicated successfully" + }); - navigate({ - to: "/organization/roles/$roleId", - params: { - roleId: newRole.id - } - }); + navigate({ + to: "/organization/roles/$roleId", + params: { + roleId: newRole.id + } + }); - onClose(); - } catch { - // query client creates notification - } + onClose(); }; return ( diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal.tsx index 4e06a845f..4ac54e973 100644 --- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal.tsx +++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal.tsx @@ -49,30 +49,26 @@ const Content = ({ role, onClose }: ContentProps) => { const navigate = useNavigate(); const handleDuplicateRole = async (form: FormData) => { - try { - const newRole = await createRole.mutateAsync({ - projectId: currentWorkspace.id, - permissions: role.permissions, - ...form - }); + const newRole = await createRole.mutateAsync({ + projectId: currentWorkspace.id, + permissions: role.permissions, + ...form + }); - createNotification({ - type: "success", - text: "Role duplicated successfully" - }); + createNotification({ + type: "success", + text: "Role duplicated successfully" + }); - navigate({ - to: `/${currentWorkspace.type}/$projectId/roles/$roleSlug` as const, - params: { - roleSlug: newRole.slug, - projectId: currentWorkspace.id - } - }); + navigate({ + to: `/${currentWorkspace.type}/$projectId/roles/$roleSlug` as const, + params: { + roleSlug: newRole.slug, + projectId: currentWorkspace.id + } + }); - onClose(); - } catch { - // query client creates notification - } + onClose(); }; return (