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

✨ 피드 신고하기 API #66

Merged
merged 9 commits into from
May 16, 2024
Merged

✨ 피드 신고하기 API #66

merged 9 commits into from
May 16, 2024

Conversation

BangDori
Copy link
Collaborator

@BangDori BangDori commented May 16, 2024

작업 이유

  • 피드 신고하기 API 작업

작업 사항

1️⃣ 피드 신고하기 API

  • 현재 UI가 완성되지 않아, onSuccess, onError 후속 처리가 아직 완성되었지 않습니다! 이 부분에 대해서는 이슈로 등록하였습니다.

2️⃣ 신고 카테고리

기존에 신고 카테고리를 아래 이유로 map에서 array로 변경하였습니다.

  • Map 객체의 get 메서드의 타입이 string | undefined로 설정됩니다.
  • 맵 객체 전체를 상태로 관리하기 보다는 클릭한 아이디에 대한 정보를 관리하는 것이 업데이트 측면에서 더 빠르다.
  • 조회에 대해 많은 시간 차이가 발생하지 않는다. (map.get(1), array[1] => O(1))

3️⃣ ESLint 설정

  • `argsIgnorePattern: '_'를 추가하여 _를 사용하는 변수 혹은 매개변수에 대해 eslint가 동작되지 않게 설정하였습니다.

리뷰어가 중점적으로 확인해야 하는 부분

const handleSubmitReports = async (event: React.FormEvent) => {
  event.preventDefault();

  const body = {
    category: REPORT_CATEGORIES[clickedId],
    content,
    isBlind,
  };

  await reportFeed(body); // 🚨 'await' has no effect on the type of this expression.ts(80007)
  onClose();
};

신고하기 제출 이후에 서버에 정상 반영 된 이후에 모달창을 닫도록 구현하였는데, mutation이 비동기로 잡히지 않아서 await가 정상적으로 적용되고 있지 않는 문제가 발생하였습니다..!

이 부분을 어떻게 처리하면 좋을까요?


발견한 이슈

  1. ✨ 피드 신고하기 UI 수정 #65
  2. 🔧 피드 신고하기 Props Drilling #67

@BangDori BangDori self-assigned this May 16, 2024
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-66.d37mn03xh3qyyz.amplifyapp.com

Copy link
Member

@Legitgoons Legitgoons left a comment

Choose a reason for hiding this comment

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

수고 많으셨습니다.

mutate의 비동기 처리에 대해서 찾아봤는데, mutate 대신 mutateAsync를 사용하면 promise를 반환받을 수 있다고 합니다. 이 부분 참고하시면 도움이 될 것 같습니다...!

Copy link
Member

@Legitgoons Legitgoons left a comment

Choose a reason for hiding this comment

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

수고하셨습니다. 병합하셔도 좋습니다!

@BangDori
Copy link
Collaborator Author

@Legitgoons 오늘도 가르침에 감사합니다 선생님 👍

@BangDori BangDori merged commit 7932529 into main May 16, 2024
2 checks passed
@BangDori BangDori deleted the feature/PW-326-feed-reports branch May 16, 2024 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants