import React from 'react' import { Route, Redirect } from 'react-router-dom' import { isInRole, Role } from './PrivateContent' type PrivateRouteProps = { children: any roles: Role[] [other: string]: any } export const PrivateRoute: React.FC = ({ children, roles, ...other }) => { const token = localStorage['token'] return ( token && isInRole(roles) ? children : ( ) } /> ) }