]> Untitled Git - lemmy-ui.git/commitdiff
Navigate away from login page if already logged in. (#429)
authorDessalines <dessalines@users.noreply.github.com>
Sun, 19 Sep 2021 20:28:44 +0000 (16:28 -0400)
committerGitHub <noreply@github.com>
Sun, 19 Sep 2021 20:28:44 +0000 (16:28 -0400)
- Fixes #370

src/shared/components/home/login.tsx

index 30e5d90966bd089ea8761df4fc9c9205b22125dd..c6338af4d68c136c620e1129dd88aa1b8c6831d6 100644 (file)
@@ -105,6 +105,13 @@ export class Login extends Component<any, State> {
     }
   }
 
+  componentDidMount() {
+    // Navigate to home if already logged in
+    if (UserService.Instance.myUserInfo) {
+      this.context.router.history.push("/");
+    }
+  }
+
   componentWillUnmount() {
     if (isBrowser()) {
       this.subscription.unsubscribe();