Skip to content
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

Merged
merged 20 commits into from
Mar 6, 2024

Conversation

HY219
Copy link
Contributor

@HY219 HY219 commented Feb 28, 2024

📝 작업 내용

  • 이미지 상세 모달에서 신고하기 이미지 버튼 클릭 시 신고하기 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
    image

    ./src/apis/zzal.ts
    image

  • 신고하기 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를 가져와야합니다.
  • 이미지 상세 모달에서 신고하기 이미지 버튼 클릭 시 신고 확인 모달 을 먼저 출력해야하는데, 새로 이슈 생성해서 구현하도록 하겠습니다:)

  • 추가로, 이미 이미지를 한 번 신고한 유저가 같은 이미지를 재신고하는 동작은 허용되지 않도록 서버에서 작업해주신 것 같아요.
    image

    => 신고했던 이미지를 재신고하는 동작을 했을 때, '이미 신고한 이미지입니다.'라는 toast 메시지 또는 모달을 띄우면 좋을 것 같아요!

    정하면 좋을 것 같습니다:)

  • 코드 동작을 브라우저에서 확인하려면, ./src/routes/_layout-with-chat/index.tsx 파일에 ImageDetailModal 컴포넌트를 import 하고, 4번째 줄에 다음 코드를 추가해 주세요:)

    return ( <><ImageDetailModal isOpen={true} onClose={() => {}} /></> );

close #74

짤 이미지 상세 모달에서 신고 이미지 버튼 클릭 시 POST 요청
/report/ 로 POST 요청
이미지 상세보기 api 연결 구현 후, 실제 imageId 추가 필요
@HY219 HY219 added the ✨ Feature 새로운 기능 추가 label Feb 28, 2024
@HY219 HY219 self-assigned this Feb 28, 2024
Copy link

vercel bot commented Feb 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
zzalmyu-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 6, 2024 1:57am

src/apis/zzal.ts Outdated Show resolved Hide resolved
src/types/zzal.dto.ts Outdated Show resolved Hide resolved
src/hooks/api/zzal/usePostReportZzal.ts Outdated Show resolved Hide resolved
src/hooks/api/zzal/usePostReportZzal.ts Outdated Show resolved Hide resolved
src/components/ImageDetailModal/ImageMenuBar.tsx Outdated Show resolved Hide resolved
src/apis/zzal.ts Outdated Show resolved Hide resolved
src/apis/zzal.ts Outdated Show resolved Hide resolved
POST 요청이 성공/실패 했을 때 동작하는 로깅 삭제
요청 파라미터 imageId 축약
재신고 시 POST 요청이 실패 되므로, 추후 POST 요청 실패 시 알림 코드 추가 필요
POST 요청에 대한 응답 타입이 존재하지 않으므로 타입 삭제
POST 요청에 비동기 처리를 하여 응답 대기 시간 단축
src/apis/report.ts Outdated Show resolved Hide resolved
src/hooks/api/zzal/usePostReportZzal.ts Outdated Show resolved Hide resolved
src/components/ImageDetailModal/ImageMenuBar.tsx Outdated Show resolved Hide resolved
src/components/ImageDetailModal/ImageMenuBar.tsx Outdated Show resolved Hide resolved
src/apis/report.ts Outdated Show resolved Hide resolved
response 데이터가 없어서, void로 명시
객체 형식으로 받아오던 imageId를 변수 형식으로 변경
객체 형식 타입 정의 제거
MutateFunction이 Promise를 반환해줌으로 async/await 처리를 해주지 않아도 된다.
src/apis/report.ts Outdated Show resolved Hide resolved
C:/Program Files/Git/report/ -> /v1/report/ 로 변경
Copy link
Contributor

@Kim-Jaemin420 Kim-Jaemin420 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!

400: 이미 신고가 완료되었습니다.
500: 신고가 올바르게 되지 않았습니다.
HY219 added 3 commits March 6, 2024 10:39
추후 작업
> 기존에 작성했던 axios errorcode와 실제 필요한 error 코드인 서버의 custom error는 다르다
TODO: 이미 신고한 짤일 경우 알맞는 Toast메시지 출력
TODO: 서버 커스텀 http error code 별 Toast메시지 출력
TODO: http 요청이 예상치 못하게 실패했을 경우 Toast메시지 출력
Copy link
Contributor

@yjc2021 yjc2021 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다 LGTM 👍

Copy link
Contributor

@choi-ik choi-ik left a 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억

Copy link
Contributor

@hyeonjinan096 hyeonjinan096 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다👍👍👍

@HY219 HY219 merged commit 48c3d69 into main Mar 6, 2024
3 checks passed
@HY219 HY219 deleted the #74/feature/report-zzal-api branch March 6, 2024 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature 새로운 기능 추가
Projects
None yet
Development

Successfully merging this pull request may close these issues.

짤 신고하기 api 연결
5 participants