mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
25 lines
558 B
JavaScript
25 lines
558 B
JavaScript
import { useEffect } from "react";
|
|||
|
|
import { toast } from "react-toastify";
|
||
|
|
|
||
|
|
const useSuccess = (message, deps) => {
|
||
|
|
useEffect(() => {
|
||
|
|
if (message) {
|
||
|
|
const toastId = toast.success(message.toString(), {
|
||
|
|
position: "top-right",
|
||
|
|
autoClose: 3000,
|
||
|
|
hideProgressBar: false,
|
||
|
|
closeOnClick: false,
|
||
|
|
pauseOnHover: false,
|
||
|
|
draggable: false,
|
||
|
|
progress: undefined,
|
||
|
|
theme: "dark",
|
||
|
|
});
|
||
|
|
|
||
|
|
return () => {
|
||
|
|
toast.dismiss(toastId);
|
||
|
|
};
|
||
|
|
}
|
||
|
|
}, deps);
|
||
|
|
};
|
||
|
|
|
||
|
|
export default useSuccess;
|