refresh and message on group delete (#270)

fixing: #129
This commit is contained in:
Erik Jan de Wit 2021-01-05 20:56:16 +01:00 committed by GitHub
parent c1282b2973
commit db4f7851fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,14 +60,16 @@ export const GroupsSection = () => {
setIsCreateModalOpen(!isCreateModalOpen); setIsCreateModalOpen(!isCreateModalOpen);
}; };
const deleteGroup = (group: GroupRepresentation) => { const deleteGroup = async (group: GroupRepresentation) => {
try { try {
return adminClient.groups.del({ await adminClient.groups.del({
id: group.id!, id: group.id!,
}); });
addAlert(t("groupDelete"), AlertVariant.success);
} catch (error) { } catch (error) {
addAlert(t("groupDeleteError", { error }), AlertVariant.danger); addAlert(t("groupDeleteError", { error }), AlertVariant.danger);
} }
return true;
}; };
const multiDelete = async () => { const multiDelete = async () => {
@ -147,8 +149,7 @@ export const GroupsSection = () => {
{ {
title: t("common:delete"), title: t("common:delete"),
onRowClick: async (group: GroupRepresentation) => { onRowClick: async (group: GroupRepresentation) => {
await deleteGroup(group); return deleteGroup(group);
return true;
}, },
}, },
]} ]}