🔧 PDF 404 오류 해결 및 로딩 상태 개선

🛠️ PDF 404 오류 해결:
- PDF 파일 존재 여부를 HEAD 요청으로 먼저 확인
- 파일이 존재할 때만 iframe src 설정
- 토큰을 URL 파라미터로 전달 (_token)
- 백엔드 PDF API에서 _token 파라미터 지원

📱 PDF 미리보기 로딩 개선:
- pdfLoading, pdfLoaded, pdfSrc 상태 추가
- 로딩 중 스피너 표시
- iframe 로드 완료/에러 이벤트 처리
- handlePdfError() 함수로 에러 처리 개선

🎯 사용자 경험 개선:
- PDF 로딩 상태 명확한 표시
- 에러 발생 시 적절한 메시지
- 불필요한 404 요청 방지
- 리소스 정리 개선

🔍 디버깅 개선:
- PDF 로드 과정 상세 로깅
- 에러 원인 명확한 표시
- 파일 존재 여부 사전 확인
This commit is contained in:
Hyungi Ahn
2025-09-02 17:22:35 +09:00
parent 2d25c04457
commit d4b10b16b1
3 changed files with 61 additions and 6 deletions

View File

@@ -511,7 +511,7 @@ async def get_document_content(
@router.get("/{document_id}/pdf")
async def get_document_pdf(
document_id: str,
token: Optional[str] = Query(None),
_token: Optional[str] = Query(None),
current_user: User = Depends(get_current_active_user),
db: AsyncSession = Depends(get_db)
):