Permission Router - In-Progress

This commit is contained in:
Indrajith K L
2019-12-11 19:04:14 +05:30
parent 8988233da8
commit f41d980fd8
3 changed files with 10 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ export const CustomRouter = ({ xComponent: Component, ...xProps }) => {
<Route
{...xProps}
render={props => {
console.log(props.permissions)
let returnProps = {...xProps, ...props};
let token = Storage.get("token");
let pathName = props.match.path;
if (!token && pathName !== "/login") {
@@ -19,8 +19,7 @@ export const CustomRouter = ({ xComponent: Component, ...xProps }) => {
return <Redirect to="/dashboard" />;
}
debugger
return <Component {...props} />;
return <Component {...returnProps} />;
}}
/>
);

View File

@@ -0,0 +1,4 @@
import React from "react";
import { Route, Redirect } from "react-router-dom";
// export const Permi

View File

@@ -1,6 +1,10 @@
import React, {Component} from 'react';
class AdminContainer extends Component{
constructor(props){
console.log(props);
super(props);
}
render(){
return(