aboutsummaryrefslogtreecommitdiff
path: root/src/core/routes.js
diff options
context:
space:
mode:
authorIndrajith K L2019-12-11 18:54:05 +0530
committerIndrajith K L2019-12-11 18:54:05 +0530
commit8988233da897e8447a1dbdb700836fb8576e5e6b (patch)
tree0bcaaf9657f35320ea110085ed0c40f815100a55 /src/core/routes.js
parent53e5edb3d93d957f82034be43940d560540525a8 (diff)
downloadreact-redux-saga-starter-8988233da897e8447a1dbdb700836fb8576e5e6b.tar.gz
react-redux-saga-starter-8988233da897e8447a1dbdb700836fb8576e5e6b.tar.bz2
react-redux-saga-starter-8988233da897e8447a1dbdb700836fb8576e5e6b.zip
:tada: Initial Commit
Diffstat (limited to 'src/core/routes.js')
-rw-r--r--src/core/routes.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/core/routes.js b/src/core/routes.js
new file mode 100644
index 0000000..764e793
--- /dev/null
+++ b/src/core/routes.js
@@ -0,0 +1,35 @@
+import React, { Suspense } from "react";
+import { Provider } from "react-redux";
+import { ConnectedRouter } from "connected-react-router";
+import { Switch, Redirect, Route } 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";
+
+const Routes = ({ store, history }) => {
+ return (
+ <Provider store={store}>
+ <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>
+ </Provider>
+ );
+};
+
+export default Routes; \ No newline at end of file