Skip to content
Snippets Groups Projects

CE-2917: Redirect to IOC list view after deletion of IOC

Merged Johanna Szepanski requested to merge CE-2917-delete-ioc-redirect into develop
1 file
+ 4
2
Compare changes
  • Side-by-side
  • Inline
@@ -6,6 +6,7 @@ import React, {
useMemo
} from "react";
import { useNavigate } from "react-router-dom";
import { useCustomSnackbar } from "../../common/snackbar";
import { Box, Button, Typography, Grid, Tooltip } from "@mui/material";
import { ConfirmDangerActionDialog } from "@ess-ics/ce-ui-common";
import Alert from "@mui/material/Alert";
@@ -15,13 +16,13 @@ import { useAPIMethod } from "@ess-ics/ce-ui-common";
export default function IOCDelete({ ioc, buttonDisabled, setButtonDisabled }) {
const navigate = useNavigate();
const showSnackBar = useCustomSnackbar();
// for the dialog
const [error, setError] = useState();
const [open, setOpen] = useState(false);
const client = useContext(apiContext);
const params = useMemo(
() => ({
ioc_id: ioc?.id
@@ -49,7 +50,8 @@ export default function IOCDelete({ ioc, buttonDisabled, setButtonDisabled }) {
useEffect(() => {
if (dataready && !error) {
setButtonDisabled(false);
navigate(-1);
showSnackBar(`IOC ${ioc.namingName} deleted`, "success");
navigate("/iocs");
}
}, [dataready, navigate, error, setButtonDisabled]);
Loading