Files
sam-react-prod/claudedocs/archive/sessions/[NEXT-2025-12-30] fetch-wrapper-session-context.md
유병철 07374c826c refactor(WEB): claudedocs 재정리 및 AuthContext/Zustand/유틸 코드 개선
- claudedocs 폴더 구조 재정리: archive/sessions, guides/migration·mobile·universal-list, refactoring 분류
- 오래된 세션 컨텍스트/체크리스트 문서 정리 (아카이브 이동 또는 삭제)
- AuthContext → authStore(Zustand) 전환 시작, RootProvider 간소화
- GenericCRUDDialog 공통 다이얼로그 컴포넌트 추가
- PermissionDialog 삭제 → GenericCRUDDialog로 대체
- RankDialog/TitleDialog GenericCRUDDialog 기반으로 리팩토링
- toast-utils.ts 삭제 (미사용)
- fileDownload.ts 개선, excel-download.ts 정리
- menuStore/themeStore Zustand 셀렉터 최적화
- useColumnSettings/useTableColumnStore 기능 보강
- 세금계산서/견적/작업자화면/결재 등 소규모 개선

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 17:17:13 +09:00

2.5 KiB

ㅏ# 세션 요약 (2025-12-30)

완료된 작업

1. fetch-wrapper 목적 확인

  • 목적: 401 에러(세션 만료) 발생 시 로그인 리다이렉트를 중앙화
  • 장점: 중복 코드 제거 + 새 작업자도 규칙 준수 가능

2. Accounting 도메인 완료 (12/12)

  • SalesManagement/actions.ts
  • VendorManagement/actions.ts
  • PurchaseManagement/actions.ts
  • DepositManagement/actions.ts
  • WithdrawalManagement/actions.ts
  • VendorLedger/actions.ts
  • ReceivablesStatus/actions.ts
  • ExpectedExpenseManagement/actions.ts
  • CardTransactionInquiry/actions.ts
  • DailyReport/actions.ts
  • BadDebtCollection/actions.ts
  • BankTransactionInquiry/actions.ts

3. HR 도메인 진행중 (1/6)

  • EmployeeManagement/actions.ts (이미 마이그레이션되어 있었음)
  • [~] VacationManagement/actions.ts (import만 변경됨, 함수 마이그레이션 필요)

다음 세션 TODO

HR 도메인 나머지 (5개)

  • VacationManagement/actions.ts - 함수 마이그레이션 완료 필요
  • SalaryManagement/actions.ts
  • CardManagement/actions.ts
  • DepartmentManagement/actions.ts
  • AttendanceManagement/actions.ts

기타 도메인 (Approval, Production, Settings, 기타)

  • Approval: 4개
  • Production: 4개
  • Settings: 11개
  • 기타: 12개
  • 상세 목록은 체크리스트 문서 참고

빌드 검증

  • npm run build 실행하여 마이그레이션 검증

참고 사항

마이그레이션 패턴 (참고용)

// Before
import { cookies } from 'next/headers';
async function getApiHeaders() { ... }
const response = await fetch(url, { headers });

// After
import { serverFetch } from '@/lib/api/fetch-wrapper';
const { response, error } = await serverFetch(url, { method: 'GET' });
if (error) return { success: false, error: error.message };

주요 변경 포인트

  1. getApiHeaders() 함수 제거
  2. import { cookies } from 'next/headers' 제거
  3. fetch()serverFetch() 변경
  4. { response, error } 구조분해 사용
  5. 파일 다운로드(Excel/PDF)는 cookies import 유지 (custom Accept 헤더 필요)

특이사항

  • EmployeeManagement/actions.ts는 이미 serverFetch 사용 중이었음
  • uploadProfileImage 함수는 FormData 업로드라 cookies import 유지

체크리스트 문서

claudedocs/api/[IMPL-2025-12-30] fetch-wrapper-migration.md

진행률

  • 전체: 49개 파일
  • 완료: 13개 (27%)
  • 남음: 36개