modal accept with notifications
This commit is contained in:
15
src/hooks/useNotification.js
Normal file
15
src/hooks/useNotification.js
Normal file
@ -0,0 +1,15 @@
|
||||
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 }
|
||||
};
|
Reference in New Issue
Block a user