1- import React , { Component } from 'react' ;
1+ import React , { Component } from 'react' ;
22import { BrowserRouter as Router , Route , Switch } from 'react-router-dom' ;
33import ProductShowPage from './ProductShowPage' ;
44import ProductIndexPage from './ProductIndexPage' ;
55import NewProductPage from './NewProductPage' ;
66import SignInPage from './SignInPage' ;
77import HomePage from './HomePage' ;
88import NavBar from './NavBar' ;
9- import { User , Session } from '../requests'
9+ import { User , Session } from '../requests' ;
1010import AuthRoute from './AuthRoute' ;
11+ import NotFoundPage from './NotFoundPage' ;
1112
1213class App extends Component {
1314 constructor ( props ) {
1415 super ( props ) ;
1516 this . state = {
16- currentUser : null
17- }
17+ currentUser : null ,
18+ } ;
1819 this . getUser = this . getUser . bind ( this ) ;
1920 this . destroySession = this . destroySession . bind ( this ) ;
2021 }
@@ -28,7 +29,7 @@ class App extends Component {
2829 if ( currentUser . id ) {
2930 this . setState ( { currentUser } ) ;
3031 }
31- } )
32+ } ) ;
3233 }
3334
3435 componentDidMount ( ) {
@@ -42,8 +43,12 @@ class App extends Component {
4243 < div className = "App" >
4344 < NavBar currentUser = { currentUser } onSignOut = { this . destroySession } />
4445 < Switch >
45- < Route path = "/session/new" exact render = {
46- ( routeProps ) => < SignInPage { ...routeProps } onSignIn = { this . getUser } /> }
46+ < Route
47+ path = "/session/new"
48+ exact
49+ render = { routeProps => (
50+ < SignInPage { ...routeProps } onSignIn = { this . getUser } />
51+ ) }
4752 />
4853 < AuthRoute
4954 isAuth = { currentUser }
@@ -64,11 +69,12 @@ class App extends Component {
6469 component = { ProductIndexPage }
6570 />
6671 < Route path = "/" exact component = { HomePage } />
72+ < Route component = { NotFoundPage } />
6773 </ Switch >
6874 </ div >
6975 </ Router >
7076 ) ;
7177 }
72- } ;
78+ }
7379
7480export default App ;
0 commit comments