Skip to content

Commit

Permalink
chore: fixing sonar issues HAUKI-672
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkojamG committed Dec 11, 2024
1 parent 8fcfa88 commit ef1c514
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/router/PermissionResolver.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ const PermissionResolver = ({
const { pathname, search } = useLocation();
const navigate = useNavigate();
const isAuthenticated = !!authTokens;
const [isLoading, setLoading] = useState<boolean>(true);
const [isLoading, setIsLoading] = useState<boolean>(true);
const [isAuthorized, setIsAuthorized] = useState<boolean>(false);

useEffect(() => {
if (!id || !isAuthenticated) {
setLoading(false);
setIsLoading(false);
} else {
api
.testResourcePostPermission(id)
.then((hasPermission: boolean) => {
setIsAuthorized(hasPermission);
setLoading(false);
setIsLoading(false);
})
.catch((e) => {
if (clearAuth) {
Expand All @@ -35,7 +35,7 @@ const PermissionResolver = ({
if (e.response?.status === 404) {
return navigate(`/not_found?original_request=${pathname}${search}`);
}
return setLoading(false);
return setIsLoading(false);
});
}
}, [clearAuth, navigate, id, isAuthenticated, pathname, search]);
Expand Down

0 comments on commit ef1c514

Please sign in to comment.