mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
show error messages in flash message when wiping (#17245)
quick change to show the error message when wiping fails
This commit is contained in:
parent
1710e1c8ef
commit
66f5c34288
1 changed files with 3 additions and 4 deletions
|
|
@ -1,12 +1,12 @@
|
|||
import React, { useContext } from "react";
|
||||
|
||||
import hostAPI from "services/entities/hosts";
|
||||
import { getErrorReason } from "interfaces/errors";
|
||||
|
||||
import Modal from "components/Modal";
|
||||
import Button from "components/buttons/Button";
|
||||
import Checkbox from "components/forms/fields/Checkbox";
|
||||
import { NotificationContext } from "context/notification";
|
||||
import { AxiosError } from "axios";
|
||||
|
||||
const baseClass = "wipe-modal";
|
||||
|
||||
|
|
@ -28,9 +28,8 @@ const WipeModal = ({ id, hostName, onSuccess, onClose }: IWipeModalProps) => {
|
|||
await hostAPI.wipeHost(id);
|
||||
onSuccess();
|
||||
renderFlash("success", "Success! Host is wiping.");
|
||||
} catch (error) {
|
||||
const err = error as AxiosError;
|
||||
renderFlash("error", err.message);
|
||||
} catch (e) {
|
||||
renderFlash("error", getErrorReason(e));
|
||||
}
|
||||
onClose();
|
||||
setIsWiping(false);
|
||||
|
|
|
|||
Loading…
Reference in a new issue