From 32b93681ba13e143e88158225701c2d9e2587dce Mon Sep 17 00:00:00 2001 From: canove Date: Tue, 6 Oct 2020 09:23:18 -0300 Subject: [PATCH] fix: can't create new user after logout an existing one --- frontend/src/context/Auth/useAuth.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/context/Auth/useAuth.js b/frontend/src/context/Auth/useAuth.js index f941cd9..8d273d2 100644 --- a/frontend/src/context/Auth/useAuth.js +++ b/frontend/src/context/Auth/useAuth.js @@ -23,7 +23,6 @@ const useAuth = () => { if (token) { api.defaults.headers.Authorization = `Bearer ${JSON.parse(token)}`; setIsAuth(true); - setLoading(false); } setLoading(false); @@ -32,8 +31,8 @@ const useAuth = () => { const token = localStorage.getItem("token"); if (token) { config.headers["Authorization"] = `Bearer ${JSON.parse(token)}`; + setIsAuth(true); } - setIsAuth(true); return config; }, error => {