Merge branch 'main' into quiz

This commit is contained in:
Mikola
2023-12-10 03:17:41 +03:00
82 changed files with 2790 additions and 1266 deletions

View File

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