fix: can't create new user after logout an existing one

This commit is contained in:
canove
2020-10-06 09:23:18 -03:00
parent cdedc45a73
commit 32b93681ba

View File

@@ -23,7 +23,6 @@ const useAuth = () => {
if (token) { if (token) {
api.defaults.headers.Authorization = `Bearer ${JSON.parse(token)}`; api.defaults.headers.Authorization = `Bearer ${JSON.parse(token)}`;
setIsAuth(true); setIsAuth(true);
setLoading(false);
} }
setLoading(false); setLoading(false);
@@ -32,8 +31,8 @@ const useAuth = () => {
const token = localStorage.getItem("token"); const token = localStorage.getItem("token");
if (token) { if (token) {
config.headers["Authorization"] = `Bearer ${JSON.parse(token)}`; config.headers["Authorization"] = `Bearer ${JSON.parse(token)}`;
setIsAuth(true);
} }
setIsAuth(true);
return config; return config;
}, },
error => { error => {