From db4f7851fbb95a4c8a8783d92bf640b44ecf43d7 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Tue, 5 Jan 2021 20:56:16 +0100 Subject: [PATCH] refresh and message on group delete (#270) fixing: #129 --- src/groups/GroupsSection.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/groups/GroupsSection.tsx b/src/groups/GroupsSection.tsx index e0ba3d0c78..0a6ff837d9 100644 --- a/src/groups/GroupsSection.tsx +++ b/src/groups/GroupsSection.tsx @@ -60,14 +60,16 @@ export const GroupsSection = () => { setIsCreateModalOpen(!isCreateModalOpen); }; - const deleteGroup = (group: GroupRepresentation) => { + const deleteGroup = async (group: GroupRepresentation) => { try { - return adminClient.groups.del({ + await adminClient.groups.del({ id: group.id!, }); + addAlert(t("groupDelete"), AlertVariant.success); } catch (error) { addAlert(t("groupDeleteError", { error }), AlertVariant.danger); } + return true; }; const multiDelete = async () => { @@ -147,8 +149,7 @@ export const GroupsSection = () => { { title: t("common:delete"), onRowClick: async (group: GroupRepresentation) => { - await deleteGroup(group); - return true; + return deleteGroup(group); }, }, ]}