App.js 1000 Bytes
Newer Older
1
import React, { useEffect } from 'react';
Spark's avatar
Spark committed
2
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
Spark's avatar
layout    
Spark committed
3
4
import './App.css';
import Home from './pages/Home';
Spark's avatar
Spark committed
5
import SignupPage from './pages/SignupPage';
Spark's avatar
Spark committed
6
import LoginPage from './pages/LoginPage';
Spark's avatar
Spark committed
7
import EditPage from './pages/EditPage';
Spark's avatar
Spark committed
8
9
import PrivateRoute from './utils/PrivateRoutes';
import PageNotFound from './components/PageNotFound';
Spark's avatar
Spark committed
10
import Footer from './components/Footer';
11
import { checkCookies } from './utils/CheckDB';
Spark's avatar
layout    
Spark committed
12
13
14


function App() {
15
16
17
  useEffect(() => {
    localStorage.setItem('login', false)
  }, [checkCookies()])
Spark's avatar
Spark committed
18

Spark's avatar
layout    
Spark committed
19
20
  return (
    <Router>
Spark's avatar
Spark committed
21
      <Switch>
Spark's avatar
Spark committed
22
        <Route exact path='/' component={Home} />
Spark's avatar
Spark committed
23
24
25
        <Route path='/signup' component={SignupPage} />
        <Route path='/login' component={LoginPage} />

Spark's avatar
Spark committed
26
27
        <PrivateRoute path='/edit'>
          <EditPage />
Spark's avatar
Spark committed
28
29
30
31
        </PrivateRoute>

        <Route component={PageNotFound} />
      </Switch>
Spark's avatar
Spark committed
32

Spark's avatar
Spark committed
33
      <Footer />
Spark's avatar
layout    
Spark committed
34
    </Router>
Spark's avatar
Spark committed
35

Spark's avatar
layout    
Spark committed
36
37
38
39
  );
}

export default App;