Fix remove tier error handling (#3375)

This commit is contained in:
jinapurapu
2024-06-07 15:39:18 -07:00
committed by GitHub
parent 5f7b563a01
commit 6765bd0624

View File

@@ -17,8 +17,7 @@
import React from "react";
import { ConfirmModalIcon } from "mds";
import { api } from "api";
import { errorToHandler } from "api/errors";
import { setModalErrorSnackMessage } from "../../../../systemSlice";
import { setErrorSnackMessage } from "../../../../systemSlice";
import { useAppDispatch } from "../../../../store";
import ConfirmDialog from "screens/Console/Common/ModalWrapper/ConfirmDialog";
@@ -43,10 +42,18 @@ const DeleteTierConfirmModal = ({
closeModalAndRefresh(true);
})
.catch((err) => {
dispatch(setModalErrorSnackMessage(errorToHandler(err.error)));
err.json().then((body: any) => {
dispatch(
setErrorSnackMessage({
errorMessage: body.message,
detailedError: body.detailedMessage,
}),
);
});
closeModalAndRefresh(false);
});
} else {
setModalErrorSnackMessage({
setErrorSnackMessage({
errorMessage: "There was an error deleting the tier",
detailedError: "",
});