From 762b681f902f48b227221f38f65a6a6ac2b2b3cf Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Sun, 5 Dec 2021 23:36:25 +0530 Subject: [PATCH] fix(ui) - remove role errors --- frontend/app/components/Client/Roles/Roles.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/frontend/app/components/Client/Roles/Roles.tsx b/frontend/app/components/Client/Roles/Roles.tsx index 91ab2fda5..848e9fea0 100644 --- a/frontend/app/components/Client/Roles/Roles.tsx +++ b/frontend/app/components/Client/Roles/Roles.tsx @@ -31,6 +31,14 @@ function Roles(props: Props) { props.fetchList() }, []) + useEffect(() => { + if (removeErrors && removeErrors.size > 0) { + removeErrors.forEach(e => { + toast.error(e) + }) + } + }, [removeErrors]) + const closeModal = () => { setShowmModal(false) setTimeout(() => { @@ -48,13 +56,7 @@ function Roles(props: Props) { header: 'Roles', confirmation: `Are you sure you want to remove this role?` })) { - deleteRole(role.roleId).then(() => { - if (removeErrors && removeErrors.size > 0) { - removeErrors.forEach(e => { - toast.error(e) - }) - } - }) + deleteRole(role.roleId) } }