Skip to content

Commit

Permalink
error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
abailly-akamai committed Feb 15, 2024
1 parent e088666 commit 6f9d0e8
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const PlacementGroupsDeleteModal = (props: Props) => {
);
const {
data: assignedLinodes,
// error: assignedLinodesError,
error: assignedLinodesError,
} = useAllLinodesQuery(
{},
{
Expand All @@ -46,20 +46,23 @@ export const PlacementGroupsDeleteModal = (props: Props) => {
error: deletePlacementError,
isLoading,
mutateAsync: deletePlacementGroup,
reset,
reset: resetDeletePlacementGroup,
} = useDeletePlacementGroup(selectedPlacementGroup?.id ?? -1);
const {
error: unassignLinodeError,
mutateAsync: unassignLinodes,
reset: resetUnassignLinodes,
} = useUnassignLinodesFromPlacementGroup(selectedPlacementGroup?.id ?? -1);

const error = deletePlacementError ?? unassignLinodeError;
const error =
deletePlacementError || unassignLinodeError || assignedLinodesError;

React.useEffect(() => {
if (open) {
reset();
resetDeletePlacementGroup();
resetUnassignLinodes();
}
}, [open, reset]);
}, [open, resetUnassignLinodes, resetDeletePlacementGroup]);

const handleUnassignLinode = async (linode: Linode) => {
const payload: UnassignLinodesFromPlacementGroupPayload = {
Expand Down

0 comments on commit 6f9d0e8

Please sign in to comment.