{"size": 1258, "ext": "js", "max_stars_repo_path": "src/App.js", "max_stars_repo_name": "NomanSarwar663/parcel-shipment-system", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/App.js", "max_issues_repo_name": "NomanSarwar663/parcel-shipment-system", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/App.js", "max_forks_repo_name": "NomanSarwar663/parcel-shipment-system", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.1923076923, "max_line_length": 72, "alphanum_fraction": 0.6200317965}
import 'react-perfect-scrollbar/dist/css/styles.css';
import { useRoutes } from 'react-router-dom';
import { ThemeProvider, StyledEngineProvider } from '@material-ui/core';
import GlobalStyles from './components/GlobalStyles';
import theme from './theme';
import routes from './routes';
import { Provider } from 'react-redux';
import store from './store';
import { useEffect } from 'react';
import Login from "src/pages/Login";
import { Link as RouterLink, useNavigate } from 'react-router-dom';


const App = () => {
  const content = useRoutes(routes);
  const navigate = useNavigate();

  var token = localStorage.getItem("token");
  
  if (token !== null) {
    
    return (
      <Provider store={store}>
        <StyledEngineProvider injectFirst>
          <ThemeProvider theme={theme}>
            <GlobalStyles />
            {content}
          </ThemeProvider>
        </StyledEngineProvider>
      </Provider>
    );

  }
  else {
    console.log("elss")
    return (
      <Provider store={store}>
        <StyledEngineProvider injectFirst>
          <ThemeProvider theme={theme}>
            <GlobalStyles />
            <Login />
          </ThemeProvider>
        </StyledEngineProvider>
      </Provider>

    )

  }
};

export default App;
