Advertisement
Guest User

Untitled

a guest
May 2nd, 2019
1,897
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export class PrivateAdminRoute extends Component<IProps, IState> {
  2.   render() {
  3.     // @ts-ignore
  4.     const { component: Component, ...props } = this.props
  5.     let adminLoggedIn = isAdminLoggedIn();
  6.     return <Route
  7.       {...props}
  8.       render={props => (
  9.         adminLoggedIn ?
  10.           <Component {...props} />
  11.           :
  12.           <Redirect to={{ pathname: "/admin/login", state: { from: props.location } }} />
  13.       )}
  14.     />
  15.   }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement