16 lines
425 B
JavaScript
16 lines
425 B
JavaScript
|
import { useDispatch } from "react-redux";
|
||
|
|
||
|
import { setNotification, closeNotification } from "../redux/outstaffingSlice";
|
||
|
|
||
|
export const useNotification = () => {
|
||
|
const dispatch = useDispatch();
|
||
|
|
||
|
const showNotification = (notification) => {
|
||
|
dispatch(setNotification(notification))
|
||
|
setTimeout(() => {
|
||
|
dispatch(closeNotification())
|
||
|
}, 2500)
|
||
|
}
|
||
|
return { showNotification }
|
||
|
};
|