diff --git a/frontend/src/component/user/Login/Login.tsx b/frontend/src/component/user/Login/Login.tsx index 33869d1e43..4e7f266710 100644 --- a/frontend/src/component/user/Login/Login.tsx +++ b/frontend/src/component/user/Login/Login.tsx @@ -1,30 +1,25 @@ -import { useEffect } from 'react'; import ConditionallyRender from '../../common/ConditionallyRender'; import { useStyles } from './Login.styles'; import useQueryParams from '../../../hooks/useQueryParams'; import ResetPasswordSuccess from '../common/ResetPasswordSuccess/ResetPasswordSuccess'; import StandaloneLayout from '../common/StandaloneLayout/StandaloneLayout'; import { DEMO_TYPE } from '../../../constants/authTypes'; -import { useHistory } from 'react-router'; -import Authentication from "../Authentication/Authentication"; +import Authentication from '../Authentication/Authentication'; import { useAuthDetails } from '../../../hooks/api/getters/useAuth/useAuthDetails'; -import { useAuthPermissions } from '../../../hooks/api/getters/useAuth/useAuthPermissions'; +import { useAuthUser } from '../../../hooks/api/getters/useAuth/useAuthUser'; +import { Redirect } from 'react-router-dom'; const Login = () => { const styles = useStyles(); const { authDetails } = useAuthDetails(); - const { permissions } = useAuthPermissions(); + const { user } = useAuthUser(); const query = useQueryParams(); - const history = useHistory(); - - useEffect(() => { - if (permissions?.length) { - history.push('features'); - } - /* eslint-disable-next-line */ - }, [permissions?.length]); - const resetPassword = query.get('reset') === 'true'; + + if (user) { + return ; + } + return (