# Frontend FSD App + Auth — Задачи ## Phase 1: entities/session/ - [x] 1.1 Создать `entities/session/api/sessionApi.ts` (6 функций из `api/auth.ts`, импорты через `@/shared/`) - [x] 1.2 Создать `entities/session/api/sessionApi.test.ts` (из `api/auth.test.ts`, обновить импорты) - [x] 1.3 Создать `entities/session/model/sessionContext.ts` (SessionContext + SessionContextValue) - [x] 1.4 Создать `entities/session/model/useSession.ts` (useContext с guard) - [x] 1.5 Создать `entities/session/model/useSession.test.tsx` (из `hooks/useAuth.test.tsx`, обновить импорты) - [x] 1.6 Создать `entities/session/index.ts` (barrel) - [x] 1.7 Превратить `api/auth.ts` в shim - [x] 1.8 Превратить `hooks/useAuth.ts` в shim - [x] 1.9 Проверить: `npm test -w apps/frontend` ## Phase 2: app/providers/ - [x] 2.1 Создать `app/providers/SessionProvider.tsx` (lifecycle из `context/AuthContext.tsx`) - [x] 2.2 Создать `app/providers/AppProviders.tsx` (QueryClientProvider + SessionProvider) - [x] 2.3 Создать `app/providers/SessionProvider.test.tsx` (из `context/AuthContext.test.tsx`) - [x] 2.4 Создать `app/providers/index.ts` (barrel) - [x] 2.5 Превратить `context/AuthContext.tsx` в shim - [x] 2.6 Проверить: `npm test -w apps/frontend` ## Phase 3: app/routing/ - [x] 3.1 Создать `app/routing/ProtectedRoute.tsx` (из `components/ProtectedRoute.tsx`, useSession) - [x] 3.2 Создать `app/routing/AppRoutes.tsx` (из `routes.tsx`, импорты из app/layouts, app/routing) - [x] 3.3 Создать `app/routing/index.ts` (barrel) - [x] 3.4 Превратить `routes.tsx` в shim - [x] 3.5 Превратить `components/ProtectedRoute.tsx` в shim - [x] 3.6 Проверить: `npm test -w apps/frontend` ## Phase 4: app/layouts/ - [x] 4.1 Создать `app/layouts/AppLayout.tsx` (из `components/Layout.tsx`, useSession) - [x] 4.2 Создать `app/layouts/index.ts` (barrel) - [x] 4.3 Превратить `components/Layout.tsx` в shim - [x] 4.4 Проверить: `npm test -w apps/frontend` ## Phase 5: app/App.tsx - [x] 5.1 Создать `app/App.tsx` (BrowserRouter + AppRoutes) - [x] 5.2 Создать `app/index.ts` (barrel) - [x] 5.3 Превратить `App.tsx` в shim - [x] 5.4 Проверить: `npm test -w apps/frontend` ## Phase 6: main.tsx - [x] 6.1 Обновить `main.tsx` (AppProviders вместо ручной композиции) - [x] 6.2 Проверить: `npm test -w apps/frontend` ## Phase 7: update pages - [x] 7.1 `pages/LoginPage.tsx` — импорт `@/entities/session` - [x] 7.2 `pages/RegisterPage.tsx` — импорт `@/entities/session` - [x] 7.3 `pages/ProfilePage.tsx` — импорт `@/entities/session` - [x] 7.4 Финальная проверка: `npm test -w apps/frontend && npm run lint -w apps/frontend && npm run build -w apps/frontend`