import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import AuthPage from './pages/AuthPage';
import SignupPage from './pages/SignupPage';

import './index.scss';

import AuthProvider from './components/AuthProvider';
import App from './components/App';
import routes from './routes';

const eRoot = (
  <BrowserRouter>
    <Switch>
      <Route path="/" exact component={AuthPage} />
      <Route path="/signup" exact component={SignupPage} />
      <Route path="/">
        <AuthProvider>
          <App routes={routes} />
        </AuthProvider>
      </Route>
    </Switch>
  </BrowserRouter>
);

const element = document.getElementById('root');
ReactDOM.render(eRoot, element);
