Checking authentication...
import React, { useEffect, useState, lazy, Suspense } from 'react'; import { Routes, Route, useLocation } from 'react-router-dom'; import { useDispatch, useSelector } from 'react-redux'; import { getCurrentUser, checkCachedAuth, autoLogin } from './store/reducers/authSlice'; import cookieService from './services/cookieService'; import Login from './pages/Login.jsx'; import Register from './pages/Register.jsx'; import ForgotPassword from './pages/ForgotPassword.jsx'; import ResetPassword from './pages/ResetPassword.jsx'; import Dashboard from './pages/Dashboard.jsx'; import Sources from './pages/Sources.jsx'; import Accounts from './pages/Accounts.jsx'; import Posts from './pages/Posts.jsx'; import Schedule from './pages/Schedule.jsx'; import Home from './pages/Home.jsx'; import Header from './components/Header/Header.jsx'; import Sidebar from './components/Sidebar/Sidebar.jsx'; import LinkedInCallbackHandler from './components/LinkedInAccount/LinkedInCallbackHandler.jsx'; import './css/main.css'; // Lazy load components for better mobile performance const LazyFeatureCard = lazy(() => import('./components/FeatureCard')); const LazyTestimonialCard = lazy(() => import('./components/TestimonialCard')); // Error Boundary Component class ErrorBoundary extends React.Component { constructor(props) { super(props); this.state = { hasError: false, error: null }; } static getDerivedStateFromError(error) { return { hasError: true, error }; } componentDidCatch(error, errorInfo) { console.error('Error caught by boundary:', error, errorInfo); } render() { if (this.state.hasError) { return (
Please refresh the page or try again later.
Checking authentication...