Skip to content

Commit 0baad05

Browse files
committed
1 parent 32ffdd4 commit 0baad05

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/hoc/withAuthentication.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,21 @@ export default function withAuthentication(Component) {
1414

1515
useEffect(() => {
1616
if (props.auth) {
17+
let isUnmount = false;
1718
getAuthUserTokens()
1819
.then(({ tokenV3 }) => {
1920
if (!!tokenV3) {
2021
setIsLoggedIn(!!tokenV3);
21-
} else {
22+
} else if (!isUnmount) {
2223
login();
2324
}
2425
})
2526
.catch((err) => {
2627
setAuthError(err);
2728
});
29+
return () => {
30+
isUnmount = true;
31+
};
2832
}
2933
}, [props.auth]);
3034

0 commit comments

Comments
 (0)