import {
    BrowserRouter as Router,
    Switch,
    Route,
    Redirect
} from "react-router-dom";
import RouteWithSubRoutes from '@utils/RouteWithSubRoutes'
import routes from '@utils/routes';

export default function AuthIndex() {
    //const user = localStorage.getItem("token");
    return (
        <Router>
            <Switch>
                <Route
                    exact
                    path="/"
                    render={() => <Redirect to="/login" />}
                />
                {routes.map(route => (
                    <RouteWithSubRoutes key={route.path} {...route} />
                ))}
            </Switch>
        </Router>
    )
}