mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-17 19:37:02 +00:00
fix: not redirecting away from login page when logged in
This commit is contained in:
@@ -12,13 +12,6 @@ const useAuth = () => {
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
history.location.pathname === "/login" ||
|
||||
history.location.pathname === "/signup"
|
||||
) {
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
const token = localStorage.getItem("token");
|
||||
if (token) {
|
||||
api.defaults.headers.Authorization = `Bearer ${JSON.parse(token)}`;
|
||||
@@ -67,7 +60,7 @@ const useAuth = () => {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
}, [history]);
|
||||
}, []);
|
||||
|
||||
const handleLogin = async (e, user) => {
|
||||
setLoading(true);
|
||||
|
||||
Reference in New Issue
Block a user