added remove callback for group settings dialog
This commit is contained in:
parent
29d6f201c8
commit
ecc2f4d851
3 changed files with 35 additions and 5 deletions
|
|
@ -25,6 +25,7 @@ interface Props {
|
|||
group: Group;
|
||||
isDialogOpen: boolean;
|
||||
closeDialogCallback: Function;
|
||||
removeCallback?: Function;
|
||||
}
|
||||
|
||||
export default function RemoveGroup(props: Props) {
|
||||
|
|
@ -32,7 +33,7 @@ export default function RemoveGroup(props: Props) {
|
|||
const navigate = useNavigate();
|
||||
const groupAPI = useGroupAPI();
|
||||
const { success, error, warning } = useSnackbar();
|
||||
const { group, isDialogOpen, closeDialogCallback } = props;
|
||||
const { group, isDialogOpen, closeDialogCallback, removeCallback } = props;
|
||||
let groupName = group.name();
|
||||
|
||||
const closeDialog = () => {
|
||||
|
|
@ -45,10 +46,15 @@ export default function RemoveGroup(props: Props) {
|
|||
.then((response: any) => {
|
||||
success(groupName + " was successfully removed");
|
||||
// navigate("/groups");
|
||||
console.log(removeCallback)
|
||||
if (removeCallback) removeCallback()
|
||||
// removeCallback()
|
||||
})
|
||||
.catch((err: any) => {
|
||||
err ? warning(err) : error("Error occured while removing " + groupName);
|
||||
closeDialog();
|
||||
}).finally(() => {
|
||||
closeDialogCallback()
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue