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 };
};
