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 b6ff645 commit 124d317Copy full SHA for 124d317
src/hoc/withAuthentication.js
@@ -13,15 +13,20 @@ export default function withAuthentication(Component) {
13
let [authError, setAuthError] = useState(false);
14
15
useEffect(() => {
16
+ // prevent page redirecting to login page when unmount
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(setAuthError);
27
+ return () => {
28
+ isUnmount = true;
29
+ };
30
}, []);
31
32
return (
0 commit comments