Skip to content
Snippets Groups Projects
Commit b05a5c57 authored by Leonardo Christino's avatar Leonardo Christino
Browse files

chore(auth): call to header api even in dev

parent adcc21ee
No related branches found
Tags v1.14.0
No related merge requests found
Pipeline #127493 passed
......@@ -25,7 +25,7 @@ export const useAuth = () => {
const [isLogin, setLogin] = useState(false);
const dispatch = useAppDispatch();
useEffect(() => {
const handleError = (err: any) => {
if (import.meta.env.SKIP_LOGIN) {
console.warn('skipping login');
setLogin(true);
......@@ -38,8 +38,13 @@ export const useAuth = () => {
})
);
return;
} else {
setLogin(false);
console.error(err);
}
};
useEffect(() => {
fetch(`${domain}${useruri}/headers`, fetchSettings)
.then((res) =>
res
......@@ -55,15 +60,9 @@ export const useAuth = () => {
})
);
})
.catch((err) => {
console.error(err);
setLogin(false);
})
.catch(handleError)
)
.catch((err) => {
console.error(err);
setLogin(false);
});
.catch(handleError);
}, []);
return isLogin;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment