From: Dessalines Date: Sun, 19 Sep 2021 20:28:44 +0000 (-0400) Subject: Navigate away from login page if already logged in. (#429) X-Git-Url: http://these/git/%22%7Burl%7D/%22https:/image.com/%7B%60%24%7BghostArchiveUrl%7D/%7BallRss%7D?a=commitdiff_plain;h=6929b87dae59881513c7987c06d28cd73cc38303;p=lemmy-ui.git Navigate away from login page if already logged in. (#429) - Fixes #370 --- diff --git a/src/shared/components/home/login.tsx b/src/shared/components/home/login.tsx index 30e5d90..c6338af 100644 --- a/src/shared/components/home/login.tsx +++ b/src/shared/components/home/login.tsx @@ -105,6 +105,13 @@ export class Login extends Component { } } + componentDidMount() { + // Navigate to home if already logged in + if (UserService.Instance.myUserInfo) { + this.context.router.history.push("/"); + } + } + componentWillUnmount() { if (isBrowser()) { this.subscription.unsubscribe();