mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
fix: redirect from login page if authorized
This commit is contained in:
parent
86631b53c9
commit
8d295fd176
@ -50,7 +50,12 @@ const App = ({ location, user }: IAppProps) => {
|
||||
<Route
|
||||
key={route.path}
|
||||
path={route.path}
|
||||
render={props => <route.component {...props} />}
|
||||
render={props => (
|
||||
<route.component
|
||||
{...props}
|
||||
isUnauthorized={isUnauthorized}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -11,17 +11,19 @@ import { ReactComponent as UnleashLogo } from '../../../icons/unleash-logo-inver
|
||||
import { ReactComponent as SwitchesSVG } from '../../../icons/switches.svg';
|
||||
import { useStyles } from './Login.styles';
|
||||
|
||||
const Login = ({ history, loadInitialData, authDetails }) => {
|
||||
const Login = ({ history, loadInitialData, isUnauthorized, authDetails }) => {
|
||||
const theme = useTheme();
|
||||
const styles = useStyles();
|
||||
const smallScreen = useMediaQuery(theme.breakpoints.up('md'));
|
||||
|
||||
useEffect(() => {
|
||||
if (!authDetails) {
|
||||
if (isUnauthorized()) {
|
||||
loadInitialData();
|
||||
} else {
|
||||
history.push('features');
|
||||
}
|
||||
/* eslint-disable-next-line */
|
||||
}, []);
|
||||
}, [authDetails]);
|
||||
|
||||
return (
|
||||
<div className={styles.loginContainer}>
|
||||
|
Loading…
Reference in New Issue
Block a user