Permission Router - In-Progress
This commit is contained in:
@@ -7,7 +7,7 @@ export const CustomRouter = ({ xComponent: Component, ...xProps }) => {
|
|||||||
<Route
|
<Route
|
||||||
{...xProps}
|
{...xProps}
|
||||||
render={props => {
|
render={props => {
|
||||||
console.log(props.permissions)
|
let returnProps = {...xProps, ...props};
|
||||||
let token = Storage.get("token");
|
let token = Storage.get("token");
|
||||||
let pathName = props.match.path;
|
let pathName = props.match.path;
|
||||||
if (!token && pathName !== "/login") {
|
if (!token && pathName !== "/login") {
|
||||||
@@ -19,8 +19,7 @@ export const CustomRouter = ({ xComponent: Component, ...xProps }) => {
|
|||||||
|
|
||||||
return <Redirect to="/dashboard" />;
|
return <Redirect to="/dashboard" />;
|
||||||
}
|
}
|
||||||
debugger
|
return <Component {...returnProps} />;
|
||||||
return <Component {...props} />;
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
4
src/core/permission.router.js
Normal file
4
src/core/permission.router.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { Route, Redirect } from "react-router-dom";
|
||||||
|
|
||||||
|
// export const Permi
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
|
|
||||||
class AdminContainer extends Component{
|
class AdminContainer extends Component{
|
||||||
|
constructor(props){
|
||||||
|
console.log(props);
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
return(
|
return(
|
||||||
|
|||||||
Reference in New Issue
Block a user