import React, { Component } from 'react';
import { withRouter } from 'react-router-dom'
function LoggedUserRed(ComposedComponent, extraInfo) {
 class LoginAccessCrtl extends Component {
   componentWillMount(){
     let userDetail = JSON.parse(localStorage.getItem('userInfo'));
     if(userDetail){
       this.props.history.push( "/landing" );
     }
   }
   render() {
     if(!localStorage.getItem('userInfo')) {
       return(<ComposedComponent/>)
     }else {
       return null
     }
   }
 }
  return (LoginAccessCrtl);
}
export default LoggedUserRed;
