text: import React from 'react';
  import { Route, Redirect } from 'react-router-dom';
  
  // eslint-disable-next-line react/prop-types
  const RouterInterceptor = ({ component: Component, ...rest }) => {
    const isAuthenticated = localStorage.getItem('token');
    return (
      <Route
        {...rest}
        render={props =>
          isAuthenticated ? <Component {...props} /> : <Redirect to="/login" />
        }
      />
    );
  };
  
  export default RouterInterceptor;
  