import { PrimaryButton } from 'office-ui-fabric-react/lib-commonjs/Button'; import * as React from 'react'; import { UserInfo } from '../userProfile'; import { History, WithRouter } from '../withRouter'; import classNames from './withAuth.classNames'; export interface WithAuthActions { login(history: History): void; } export interface WithAuthAttributes { user: UserInfo; isLogin?(history: History): boolean; } export type WithAuthProps = WithAuthAttributes & WithAuthActions; export const withAuth =
>(Inner: React.ComponentClass
, ...roles: string[]) => class WithAuth extends React.Component
{ public render(): JSX.Element { if (this.props.user || (this.props.isLogin && this.props.isLogin(this.props.history))) { if (this.props.user && !this.authorized) { return (