From f5a851814ae03a6870ccf28b4210f575d504c8b1 Mon Sep 17 00:00:00 2001 From: Erik Michelson Date: Sun, 24 May 2020 22:39:24 +0200 Subject: [PATCH] Redirect logged-in users from /login to /history --- src/components/landing/pages/login/login.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/landing/pages/login/login.tsx b/src/components/landing/pages/login/login.tsx index 5c3671553..7597f3f63 100644 --- a/src/components/landing/pages/login/login.tsx +++ b/src/components/landing/pages/login/login.tsx @@ -9,11 +9,14 @@ import {ApplicationState} from "../../../../redux"; import {ViaOpenId} from "./auth/via-open id"; import "./login.scss"; import {ElementSeparator} from "../../../element-separator/element-separator"; +import {Redirect} from "react-router"; +import {LoginStatus} from "../../../../redux/user/types"; const Login: React.FC = () => { useTranslation(); const authProviders = useSelector((state: ApplicationState) => state.backendConfig.authProviders); const customAuthNames = useSelector((state: ApplicationState) => state.backendConfig.customAuthNames); + const userLoginState = useSelector((state: ApplicationState) => state.user.status); const emailForm = authProviders.email ? : null const ldapForm = authProviders.ldap ? : null const openIdForm = authProviders.openid ? : null @@ -28,6 +31,13 @@ const Login: React.FC = () => { return undefined; } } + + if (userLoginState === LoginStatus.ok) { + // TODO Redirect to previous page? + return ( + + ) + } return (