Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export class PrivateAdminRoute extends Component<IProps, IState> {
- render() {
- // @ts-ignore
- const { component: Component, ...props } = this.props
- let adminLoggedIn = isAdminLoggedIn();
- return <Route
- {...props}
- render={props => (
- adminLoggedIn ?
- <Component {...props} />
- :
- <Redirect to={{ pathname: "/admin/login", state: { from: props.location } }} />
- )}
- />
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement