import { Route, Router } from '@solidjs/router' import { lazy, onMount, Suspense } from 'solid-js' import { AuthProvider, useAuth } from './context/auth' // Ленивая загрузка компонентов const AdminPage = lazy(() => { console.log('[App] Loading AdminPage component...') return import('./admin') }) const LoginPage = lazy(() => { console.log('[App] Loading LoginPage component...') return import('./routes/login') }) /** * Компонент защищенного маршрута */ const ProtectedRoute = () => { console.log('[ProtectedRoute] Checking authentication...') const auth = useAuth() const authenticated = auth.isAuthenticated() console.log( `[ProtectedRoute] Authentication state: ${authenticated ? 'authenticated' : 'not authenticated'}` ) if (!authenticated) { console.log('[ProtectedRoute] Not authenticated, redirecting to login...') // Используем window.location.href для редиректа window.location.href = '/login' return (