-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
61 lines (57 loc) · 2.27 KB
/
Copy pathApp.js
File metadata and controls
61 lines (57 loc) · 2.27 KB
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
/* eslint-disable react/jsx-props-no-spreading */
import React, { Component } from "react";
import { BrowserRouter, Redirect, Route, Switch } from "react-router-dom";
import { connect } from "react-redux";
import Admin from "./layouts/Admin";
import Auth from "./layouts/Auth";
import './assets/css/style-custom.css';
import IsAuthenticated from "./services/AuthenticationService";
import { setUserState } from "./redux/action/UserAction";
import 'rsuite/dist/styles/rsuite-default.css';
import NewSupplierDialog from "./components/Dialogs/NewSupplierDialog";
import NewItemDialog from "./components/Dialogs/NewItemDialog";
import NewOrderDialog from "./components/Dialogs/NewOrderDialog";
import ViewOrderDialog from "./components/Dialogs/ViewOrderDialog";
import PaymentDialog from "./components/Dialogs/PaymentDialog";
import ErrorBoundary from "./components/ErrorBoundary";
/**
* Application main entry point and the handling point
*/
class App extends Component
{
constructor(props)
{
super(props);
this.state = { };
}
render()
{
return (
<BrowserRouter>
<ErrorBoundary>
{/* eslint-disable-next-line react/destructuring-assignment */}
{IsAuthenticated(this.props.setUserState)
? <Switch>
<Route path='/admin' component={Admin} />
<Route path='/auth' component={Auth} />
<Redirect from='/' to='/admin/index' />
{/* eslint-disable-next-line indent,react/jsx-closing-tag-location */}
</Switch>
: <Switch>
<Route path='/' component={Auth} />
{/* eslint-disable-next-line indent,react/jsx-closing-tag-location */}
</Switch>}
<NewSupplierDialog />
<NewItemDialog />
<NewOrderDialog />
<ViewOrderDialog />
<PaymentDialog />
</ErrorBoundary>
</BrowserRouter>
);
}
}
const mapStateToProps = (state) => ({
loader : state.system.loader,
});
export default connect(mapStateToProps, { setUserState })(App);