From 8988233da897e8447a1dbdb700836fb8576e5e6b Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Wed, 11 Dec 2019 18:54:05 +0530 Subject: :tada: Initial Commit --- src/core/custom.router.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/core/custom.router.js (limited to 'src/core/custom.router.js') diff --git a/src/core/custom.router.js b/src/core/custom.router.js new file mode 100644 index 0000000..b3f08ec --- /dev/null +++ b/src/core/custom.router.js @@ -0,0 +1,27 @@ +import React from "react"; +import { Route, Redirect } from "react-router-dom"; +import Storage from "../services/storage.service"; + +export const CustomRouter = ({ xComponent: Component, ...xProps }) => { + return ( + { + console.log(props.permissions) + let token = Storage.get("token"); + let pathName = props.match.path; + if (!token && pathName !== "/login") { + return ; + } else if (pathName === "/login" && token) { + + return ; + }else if (pathName === "/" && token) { + + return ; + } + debugger + return ; + }} + /> + ); + }; \ No newline at end of file -- cgit v1.2.3