Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

fix: issue #44 #48

Merged
merged 1 commit into from
Jan 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/hoc/withAuthentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@ export default function withAuthentication(Component) {
let [authError, setAuthError] = useState(false);

useEffect(() => {
// prevent page redirecting to login page when unmount
let isUnmount = false;
getAuthUserTokens()
.then(({ tokenV3 }) => {
if (!!tokenV3) {
setIsLoggedIn(!!tokenV3);
} else {
} else if (!isUnmount) {
login();
}
})
.catch(setAuthError);
return () => {
isUnmount = true;
};
}, []);

return (
Expand Down