App.js 1.12 KB
Newer Older
1
import React 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 GetLocFirst from './pages/GetLocFirst';
Spark's avatar
layout    
Spark committed
12
13
14


function App() {
15
  
16
17
18
19
20
21
22
  const isLs = localStorage.getItem('login')

  function loginDefault() {
    if (isLs === null) {
      localStorage.setItem('login', false)
    }
  }
Spark's avatar
Spark committed
23

Spark's avatar
layout    
Spark committed
24
25
  return (
    <Router>
26
      {loginDefault()}
Spark's avatar
Spark committed
27
      <Switch>
Spark's avatar
Spark committed
28
        <Route exact path='/' component={Home} />
Spark's avatar
Spark committed
29
30
        <Route path='/signup' component={SignupPage} />
        <Route path='/login' component={LoginPage} />
31
        <Route path='/first-local-code' component={GetLocFirst} />
32

Spark's avatar
Spark committed
33
34
        <PrivateRoute path='/edit'>
          <EditPage />
Spark's avatar
Spark committed
35
36
37
38
        </PrivateRoute>

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

Spark's avatar
Spark committed
40
      <Footer />
Spark's avatar
layout    
Spark committed
41
    </Router>
Spark's avatar
Spark committed
42

Spark's avatar
layout    
Spark committed
43
44
45
46
  );
}

export default App;