-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#74] Feat: 짤 이미지 신고 api 연결 구현 #76
Conversation
짤 이미지 상세 모달에서 신고 이미지 버튼 클릭 시 POST 요청 /report/ 로 POST 요청 이미지 상세보기 api 연결 구현 후, 실제 imageId 추가 필요
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
POST 요청이 성공/실패 했을 때 동작하는 로깅 삭제 요청 파라미터 imageId 축약 재신고 시 POST 요청이 실패 되므로, 추후 POST 요청 실패 시 알림 코드 추가 필요
POST 요청에 대한 응답 타입이 존재하지 않으므로 타입 삭제 POST 요청에 비동기 처리를 하여 응답 대기 시간 단축
response 데이터가 없어서, void로 명시
handleReportZzal -> handleClickReportButton
객체 형식으로 받아오던 imageId를 변수 형식으로 변경 객체 형식 타입 정의 제거
isSuccess, isError 등 추가 option 사용 가능
MutateFunction이 Promise를 반환해줌으로 async/await 처리를 해주지 않아도 된다.
C:/Program Files/Git/report/ -> /v1/report/ 로 변경
#74/feature/report-zzal-api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
400: 이미 신고가 완료되었습니다. 500: 신고가 올바르게 되지 않았습니다.
#74/feature/report-zzal-api
#74/feature/report-zzal-api
추후 작업 > 기존에 작성했던 axios errorcode와 실제 필요한 error 코드인 서버의 custom error는 다르다 TODO: 이미 신고한 짤일 경우 알맞는 Toast메시지 출력 TODO: 서버 커스텀 http error code 별 Toast메시지 출력 TODO: http 요청이 예상치 못하게 실패했을 경우 Toast메시지 출력
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다 LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!!🚀🚀🚀🚀🚀🚀🚀🚀🚀 x 5조 5억
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다👍👍👍
📝 작업 내용
신고하기 이미지 버튼
클릭 시신고하기 POST API
를 요청합니다./v1/report/{$imageId}
로 POST 요청+
handleClickReportButton
이름이 한 파일에서 중복으로 쓰여 문제가 발생해, 신고 상세 모달에서의 핸들러 함수 이름은handleClickReportCompleteButton
으로 수정해주었습니다+코드를 작성한
ImageMenuBar.tsx
파일이 다른 파일과 통합되면서 main에서 사용되지 않아, 추후 통합이 필요합니다.📷 스크린샷 (선택)
💬 리뷰 요구사항(선택)
./src/components/ImageDetailModal/ImageMenuBar.tsx
파일의13번째 줄
과./src/apis/zzal.ts
파일의4번째 줄
의변수명
이postReportZzal
으로 같아 그대로 두어도 상관없는지 변경하면 좋을지 궁금합니다!./src/components/ImageDetailModal/ImageMenuBar.tsx
./src/apis/zzal.ts
신고하기 POST API를 호출하는 함수와 타입 정의
를zzal.ts
,zzal.dto.ts
파일에 작성해주었는데,report.ts
,report.dto.ts
파일에 작성하는 것이 더 좋을지 궁금합니다!좋아요
,다운로드
등의 기능들이zzal.ts
에 포함이 될 것이라 생각해zzal.ts
에 코드를 작성했습니다..src/types/report.ts
파일에 정의 해둔인터페이스명
과 헷갈릴 여지가 있어보여zzal.ts
에 코드를 작성했습니다.변수명, 함수명, 폴더명이 가독성있게 작성되었는지 궁금합니다!
📍 기타 (선택)
이미지 상세보기 api 연결 후, 실제 imageId 추가 필요
TODO: [2024-02-28] 이미지 상세보기 api 연결 후, 실제 imageId를 가져와야합니다.
이미지 상세 모달에서
신고하기 이미지 버튼
클릭 시신고 확인 모달
을 먼저 출력해야하는데, 새로 이슈 생성해서 구현하도록 하겠습니다:)추가로, 이미 이미지를 한 번 신고한 유저가 같은 이미지를 재신고하는 동작은 허용되지 않도록 서버에서 작업해주신 것 같아요.
=> 신고했던 이미지를 재신고하는 동작을 했을 때, '이미 신고한 이미지입니다.'라는
toast 메시지
또는모달
을 띄우면 좋을 것 같아요!정하면 좋을 것 같습니다:)
코드 동작을 브라우저에서 확인하려면,
./src/routes/_layout-with-chat/index.tsx
파일에ImageDetailModal 컴포넌트
를 import 하고,4번째 줄
에 다음 코드를 추가해 주세요:)close #74