import * as React from 'react';
import { inject } from 'mobx-react';
import NotFound from 'pages/404';

export function withStaff(WrappedComponent: any) : any {

  return inject('authentication')(class WithStaff extends React.PureComponent<any> {

    static displayName = `WithData(${WrappedComponent.displayName})`;

    render() {
      if (!this.props.authentication.isStaff) {
        return (<NotFound />);
      }
      return (<WrappedComponent {...this.props}/>);
    }
  });
}
