3.0 KiB
Raw Blame History

Frontend FSD App + Auth — Задачи

Phase 1: entities/session/

  • 1.1 Создать entities/session/api/sessionApi.ts (6 функций из api/auth.ts, импорты через @/shared/)
  • 1.2 Создать entities/session/api/sessionApi.test.ts (из api/auth.test.ts, обновить импорты)
  • 1.3 Создать entities/session/model/sessionContext.ts (SessionContext + SessionContextValue)
  • 1.4 Создать entities/session/model/useSession.ts (useContext с guard)
  • 1.5 Создать entities/session/model/useSession.test.tsx (из hooks/useAuth.test.tsx, обновить импорты)
  • 1.6 Создать entities/session/index.ts (barrel)
  • 1.7 Превратить api/auth.ts в shim
  • 1.8 Превратить hooks/useAuth.ts в shim
  • 1.9 Проверить: npm test -w apps/frontend

Phase 2: app/providers/

  • 2.1 Создать app/providers/SessionProvider.tsx (lifecycle из context/AuthContext.tsx)
  • 2.2 Создать app/providers/AppProviders.tsx (QueryClientProvider + SessionProvider)
  • 2.3 Создать app/providers/SessionProvider.test.tsx (из context/AuthContext.test.tsx)
  • 2.4 Создать app/providers/index.ts (barrel)
  • 2.5 Превратить context/AuthContext.tsx в shim
  • 2.6 Проверить: npm test -w apps/frontend

Phase 3: app/routing/

  • 3.1 Создать app/routing/ProtectedRoute.tsx (из components/ProtectedRoute.tsx, useSession)
  • 3.2 Создать app/routing/AppRoutes.tsx (из routes.tsx, импорты из app/layouts, app/routing)
  • 3.3 Создать app/routing/index.ts (barrel)
  • 3.4 Превратить routes.tsx в shim
  • 3.5 Превратить components/ProtectedRoute.tsx в shim
  • 3.6 Проверить: npm test -w apps/frontend

Phase 4: app/layouts/

  • 4.1 Создать app/layouts/AppLayout.tsx (из components/Layout.tsx, useSession)
  • 4.2 Создать app/layouts/index.ts (barrel)
  • 4.3 Превратить components/Layout.tsx в shim
  • 4.4 Проверить: npm test -w apps/frontend

Phase 5: app/App.tsx

  • 5.1 Создать app/App.tsx (BrowserRouter + AppRoutes)
  • 5.2 Создать app/index.ts (barrel)
  • 5.3 Превратить App.tsx в shim
  • 5.4 Проверить: npm test -w apps/frontend

Phase 6: main.tsx

  • 6.1 Обновить main.tsx (AppProviders вместо ручной композиции)
  • 6.2 Проверить: npm test -w apps/frontend

Phase 7: update pages

  • 7.1 pages/LoginPage.tsx — импорт @/entities/session
  • 7.2 pages/RegisterPage.tsx — импорт @/entities/session
  • 7.3 pages/ProfilePage.tsx — импорт @/entities/session
  • 7.4 Финальная проверка: npm test -w apps/frontend && npm run lint -w apps/frontend && npm run build -w apps/frontend