import React from 'react'
import { Switch, Route, Redirect, Routes} from 'react-router-dom'
import { authRoutes, publicRoutes } from '../routes'

const appRouter = () => {
  const authP = true;
  return (
    <Switch>
      {/* для авторизованных пользователей */}
      {authP && authRoutes.map(({path, Component}) =>
        <Route key={path} path={path} component={Component} exact/>
      )}

      {/* для просто пользователей */}
      {publicRoutes.map(({path, Component}) =>
        <Route key={path} path={path} component={Component} exact/>
      )}
    </Switch>
  )
}

export default appRouter