-
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
REV-96/mock API (메인) 구현 #21
The head ref may contain hidden characters: "REV-96/\uBA54\uC778-\uBAA8\uD0B9"
Conversation
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.
고생하셨습니다 효리님!
useGetCreatedReview
, useGetInvitedReview
, useGetReceivedReview
뒤에 '-s'를 붙이는 것은 어떨까요? useGetReceivedReview
와 useGetReviewResult
가 계속 헷갈리더라고요...! -List
도 생각해봤지만, 컴포넌트보다는 api관련 훅이니까 붙인다면 -s
가 적합할 것 같습니다!
- 앞으로 PR제목 지라 티켓명과 똑같이 하겠습니다 🥹
interface Answer { | ||
questionId: number | ||
questionType: string | ||
answer: string[] | ||
} | ||
|
||
interface Result { | ||
reviewerId: number | ||
answers: Answer[] | ||
} | ||
|
||
interface Response { | ||
responseId: number | ||
results: Result[] | ||
} |
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.
interface Response {
responseId: number
results: {
reviewerId: number
answers: {
questionId: number
questionType: string
answer: string[]
}
}
}
저는 그냥 한 번에 때려 박는?다고 생각했는데, 대부분 depth가 깊어지면 분리하여 type을 작성할까요??
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.
뭔가 detph가 깊어지면 분리하는게 필요할 거 같습니다 (너무 복잡해질거 같아서,,depth가 깊어진다면?!)
export const MY_INFO = { | ||
id: 1, | ||
name: '[프론트엔드]김아무개', | ||
email: 'amugae@naver.com', | ||
} |
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.
저는 Dummy 데이터들은 handlers 파일 상단에 정의해두긴 했습니다만, 공통으로 빼는 것도 좋을 것 같습니다!
interface Response { | ||
responseId: number | ||
results: Result[] | ||
} |
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.
저는 -Props라고 이름을 붙여줬습니다. editResponseProps
처럼요! 어떤 것이 나을까요??
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.
요건 의논을 한번 해봐야 할 것 같습니당..!
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.
이거는 컴포넌트가 아니라서 props가 아니지 않나요?!!
@@ -0,0 +1,29 @@ | |||
import { rest } from 'msw' | |||
import { |
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.
저도 분류를 해야겠네욤..!
src/apis/hooks/useGetReviewResult.ts
Outdated
} | ||
|
||
return useQuery({ | ||
queryKey: ['/received-reviews', 'result'], |
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.
쿼리 키로 URL을 집어넣는게 어떨까요?
queryKey:[`/received-reviews/${reviewId}`]
이런형식으로 될 거 같은데 reviewId에 따라 바뀔 필요가 없을까요.?!?!
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.
오우 이런 방법이 있군요!!!
interface Answer { | ||
questionId: number | ||
questionType: string | ||
answer: string[] | ||
} | ||
|
||
interface Result { | ||
reviewerId: number | ||
answers: Answer[] | ||
} | ||
|
||
interface Response { | ||
responseId: number | ||
results: Result[] | ||
} |
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.
뭔가 detph가 깊어지면 분리하는게 필요할 거 같습니다 (너무 복잡해질거 같아서,,depth가 깊어진다면?!)
interface Response { | ||
responseId: number | ||
results: Result[] | ||
} |
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.
요건 의논을 한번 해봐야 할 것 같습니당..!
PR 제목 지라 티켓명하고 똑같이 바꿔주세요! (브랜치명 XX)
📑 구현 내용
API 명세서 기준, 메인에 해당하는 mock API를 구현했습니다.
각각의 쿼리, 뮤테이션 훅은 아래와 같이 명명했습니다.
useEditResponse
: 작성한 응답 수정useGetCreatedReview
useGetInvitedReview
useGetReceivedReview
useGetResponseForm
: 리뷰 응답자 리스트와 질문 폼 데이터useGetReviewResult
: 나에게 온 리뷰 결과 상세 데이터🚧 참고 사항
dummyData
파일에 mock 데이터를 구현했습니다.main
파일에mainHandlers
를 구현했습니다.훅 사용법은 제 이전 프로젝트 wiki 링크 참고해서 저희한테 맞게끔 규칙 정하면 좋을 거 같습니다!