18 lines
376 B
JavaScript
18 lines
376 B
JavaScript
import { useDispatch } from "react-redux";
|
|
import { useNavigate } from "react-router-dom";
|
|
|
|
import { auth } from "../redux/outstaffingSlice";
|
|
|
|
export const useLogout = () => {
|
|
const dispatch = useDispatch();
|
|
const navigate = useNavigate();
|
|
|
|
const logout = () => {
|
|
localStorage.clear();
|
|
dispatch(auth(false));
|
|
navigate("/auth");
|
|
};
|
|
|
|
return { logout };
|
|
};
|