blob: 9c2d22278250c7426623cfd0250f9b36ced832da (
plain)
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
|
import React, { Suspense } from "react";
import { Provider, connect } from "react-redux";
import { ConnectedRouter } from "connected-react-router";
import { Switch, Redirect, Route, withRouter } from "react-router-dom";
import { CustomRouter } from "./custom.router";
import LoginContainer from "../modules/login/login.container";
import DashBoardContainer from "../modules/dashboard/dashboard.container";
import { AppRoutes } from "./app.routes";
import MasterComponent from "../master/master.component";
const Routes = ({ store, history }) => {
return (
<Provider store={store}>
<MasterComponent>
<ConnectedRouter history={history}>
<Suspense
fallback={<div style={{ display: "none" }}> Loading ...</div>}
>
<Switch>
<CustomRouter path="/login" xComponent={LoginContainer} />
<CustomRouter path="/dashboard" xComponent={DashBoardContainer} />
{AppRoutes.map(_routes =>
<CustomRouter
key={_routes.path}
path={_routes.path}
xComponent={_routes.component}
permissions={_routes.permission}
/>)}
<Redirect from="*" to="/login" push />
</Switch>
</Suspense>
</ConnectedRouter>
</MasterComponent>
</Provider>
);
};
export default Routes;
|