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/readmes/%7B%7D/static/%7B%60https:/%24%7Bi%7D%60%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();