improvement: address feedback

This commit is contained in:
Scott Wilson
2025-05-14 08:58:29 -07:00
parent 7ed96164e5
commit 7e05bc86a9
2 changed files with 33 additions and 41 deletions

View File

@@ -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 (

View File

@@ -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 (