remove auth for dev
This commit is contained in:
@ -1,18 +1,16 @@
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import { auth } from "../redux/outstaffingSlice";
|
||||
import { getRole } from "../redux/roleSlice";
|
||||
|
||||
export const useLogout = () => {
|
||||
const dispatch = useDispatch();
|
||||
const userRole = useSelector(getRole);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const logout = () => {
|
||||
localStorage.clear();
|
||||
dispatch(auth(false));
|
||||
navigate(userRole === "ROLE_DEV" ? "/authdev" : "/auth");
|
||||
navigate("/auth");
|
||||
};
|
||||
|
||||
return { logout };
|
||||
|
Reference in New Issue
Block a user