import React , { FC } from 'react' ; import { Redirect } from 'react-router' ; import { PATH_NAME } from 'configs' ; import authService from 'services/authService' ; const AuthGuard = ( { children } ) => { const isAuth = authService . getAccessToken ( ) ; if ( ! isAuth ) return < Redirect to = { PATH_NAME . LOGIN } />; return < > { children } < />; } ; export default AuthGuard ;