content: import React, { Component } from 'react';
  import { observer, inject } from 'mobx-react';
  import { Redirect } from 'react-router-dom';
  
  export default function AuthProtected(Component) {
    @inject('auth') @observer
    class AuthenticatedComponent extends Component {
      constructor(props) {
        super(props);
      }
  
      render() {
        if (this.props.auth.authenticated) {
          return <Component {...this.props} />
        }
  
        return <Redirect to={{ pathname: '/', state: { from: this.props.location } }} />
      }
  
    }
  
    return AuthenticatedComponent;
  }