2023-07-14 03:03:33 +03:00
|
|
|
import { useDispatch } from "react-redux";
|
|
|
|
|
2023-07-14 03:03:49 +03:00
|
|
|
import { closeNotification, setNotification } from "../redux/outstaffingSlice";
|
2023-07-14 03:03:33 +03:00
|
|
|
|
|
|
|
export const useNotification = () => {
|
2023-07-14 03:03:49 +03:00
|
|
|
const dispatch = useDispatch();
|
2023-07-14 03:03:33 +03:00
|
|
|
|
2023-07-14 03:03:49 +03:00
|
|
|
const showNotification = (notification) => {
|
|
|
|
dispatch(setNotification(notification));
|
|
|
|
setTimeout(() => {
|
|
|
|
dispatch(closeNotification());
|
|
|
|
}, 2500);
|
|
|
|
};
|
|
|
|
return { showNotification };
|
2023-07-14 03:03:33 +03:00
|
|
|
};
|