-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
99 lines (87 loc) · 3.63 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import React, { Component } from 'react';
import './App.css';
import {Switch,Route,Redirect,withRouter} from 'react-router-dom'
import Home from './containers/home/home';
import 'semantic-ui-css/semantic.min.css';
import 'react-notifications/lib/notifications.css';
import * as actions from './store/index'
import {connect} from 'react-redux'
import Login from './containers/auth/#';
import Register from './containers/auth/Register/register';
import Logout from './containers/auth/Logout/logout';
import EventCreationMain from './containers/EventCreationMain/EventCreationMain';
import EventCreationBase from './containers/EventCreationBase/EventCreationBase';
import Myevents from './containers/MyEvents/MyEvents';
import Test from './containers/Test/Test';
import EventController from './containers/EventController/EventController';
import HomeBase from './containers/HomeBase/HomeBase';
import UserProfile from './containers/UserProfile/UserProfile';
import UserSearch from './containers/UserSearch/UserSearch';
import EventView from './containers/EventView/EventView';
import EventViewOriginal from './containers/EventView/EventViewOriginal';
import TicketView from './containers/TicketView/TicketView';
import UserConfirmation from './containers/UserConfirmation/UserConfirmation';
class App extends Component {
componentDidMount(){
// this.props.onTryAuto#();
}
render() {
let routes = null;
if(this.props.isAuthenticated){
routes = (
<Switch>
<Route path="/register" component={Register}/>
<Route path="/#" component={Login} />
<Route path="/logout" component={Logout} />
<Route path="/event-main" component={EventCreationMain} />
<Route path="/event-base" component={EventCreationBase} />
<Route path="/my-events" component={Myevents} />
<Route path="/event-controller/:id" component={EventController} />
<Route path="/ticket-view" component={TicketView} />
<Route path="/test" component={Test} />
<Route path="/profile" component={UserProfile} />
<Route path="/user-search" component={UserSearch} />
<Route path="/event-view" component={EventView} />
<Route path="/view-event" component={EventViewOriginal} />
<Route path="/user-confirmation" component={UserConfirmation} />
<Route path="/" exact component={Home} />
<Redirect to="/" />
</Switch>
)
} else {
routes = (
<Switch>
<Route path="/register" component={Register}/>
<Route path="/#" component={Login} />
<Route path="/logout" component={Logout} />
<Route path="/event-main" component={EventCreationMain} />
<Route path="/event-base" component={EventCreationBase} />
<Route path="/my-events" component={Myevents} />
<Route path="/event-controller/:id" component={EventController} />
<Route path="/test" component={Test} />
<Route path="/profile" component={UserProfile} />
<Route path="/user-confirmation" component={UserConfirmation} />
<Route path="/user-search" component={UserSearch} />
<Route path="/" exact component={HomeBase} />
<Redirect to="/" />
</Switch>
)
}
return (
<div>
{routes}
</div>
);
}
}
const mapStateToProps = state => {
return {
isAuthenticated: state.auth.accessToken != null
}
};
const mapDispatchToProps = dispatch => {
return{
onTryAuto# : () => dispatch (actions.authCheckState())
}
};
export default withRouter(connect(mapStateToProps,mapDispatchToProps)(App));