Files
bigcapital/client/src/components/Authentication.js
Ahmed Bouhuolia 73711384f6 WIP
2020-03-16 00:06:15 +02:00

29 lines
831 B
JavaScript

import React from 'react';
import { Redirect, Route, Switch } from 'react-router-dom';
import authenticationRoutes from 'routes/authentication';
export default function({ isAuthenticated =false, ...rest }) {
const to = {pathname: '/dashboard/homepage'};
return (
<Route path="/auth">
{ (isAuthenticated) ?
(<Redirect to={to} />) : (
<Switch>
<div class="authentication-page">
<div class="authentication-page__form-wrapper">
{ authenticationRoutes.map((route, index) => (
<Route
key={index}
path={route.path}
exact={route.exact}
component={route.component}
/>
))}
</div>
</div>
</Switch>)
}
</Route>
);
}