We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 32ffdd4 commit 0baad05Copy full SHA for 0baad05
src/hoc/withAuthentication.js
@@ -14,17 +14,21 @@ export default function withAuthentication(Component) {
14
15
useEffect(() => {
16
if (props.auth) {
17
+ let isUnmount = false;
18
getAuthUserTokens()
19
.then(({ tokenV3 }) => {
20
if (!!tokenV3) {
21
setIsLoggedIn(!!tokenV3);
- } else {
22
+ } else if (!isUnmount) {
23
login();
24
}
25
})
26
.catch((err) => {
27
setAuthError(err);
28
});
29
+ return () => {
30
+ isUnmount = true;
31
+ };
32
33
}, [props.auth]);
34
0 commit comments