Fakultas Ilmu Komputer UI

Commit c77ed5e6 authored by FadhilP's avatar FadhilP
Browse files

[REFACTOR] Add error toast on send data

parent ce23e503
......@@ -19,6 +19,18 @@ const useSendData = ({ url, header = {}, redirect = "./", method }) => {
transition: Slide,
}
);
const notifyError = () => toast.error("Gagal Tersimpan", {
position: "top-right",
autoClose: 5000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
transition: Slide,
})
const sendFunction = useCallback(
(data) => {
setErrorState(false);
......@@ -39,6 +51,7 @@ const useSendData = ({ url, header = {}, redirect = "./", method }) => {
notify()
navigate(redirect);
} else {
notifyError()
throw new Error("Error");
}
})
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment