Permission Router - In-Progress
This commit is contained in:
@@ -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} />;
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
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';
|
||||
|
||||
class AdminContainer extends Component{
|
||||
constructor(props){
|
||||
console.log(props);
|
||||
super(props);
|
||||
}
|
||||
|
||||
render(){
|
||||
return(
|
||||
|
||||
Reference in New Issue
Block a user