-
Notifications
You must be signed in to change notification settings - Fork 1
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
refactor : rank Api querykey factor #876
The head ref may contain hidden characters: "feature/rankApi_\uCFFC\uB9AC\uD0A4_\uD3EC\uB9F7_\uD1B5\uC77C_#867"
Conversation
src/api/attendanceApi.ts
Outdated
const useGetTodayAttendanceRank = ({ page, size = 10 }: PageAndSize) => { | ||
const fetcher = () => | ||
axios | ||
.get('/attendances/today-rank', { | ||
params: { page, size }, | ||
}) | ||
.then(({ data }) => data); | ||
|
||
return useQuery<TodayAttendRank>(attendanceKeys.todayAttendanceRank({ page, size }), fetcher, { | ||
keepPreviousData: true, | ||
}); | ||
}; |
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.
저희 params 변수 따로 빼기로 한 거 요렇게 어떤가요?
const useGetTodayAttendanceRank = ({ page, size = 10 }: PageAndSize) => { | |
const fetcher = () => | |
axios | |
.get('/attendances/today-rank', { | |
params: { page, size }, | |
}) | |
.then(({ data }) => data); | |
return useQuery<TodayAttendRank>(attendanceKeys.todayAttendanceRank({ page, size }), fetcher, { | |
keepPreviousData: true, | |
}); | |
}; | |
const useGetTodayAttendanceRank = ({ page, size = 10 }: PageAndSize) => { | |
const params = { page, size }; | |
const fetcher = () => | |
axios | |
.get('/attendances/today-rank', { | |
params, | |
}) | |
.then(({ data }) => data); | |
return useQuery<TodayAttendRank>(attendanceKeys.todayAttendanceRank(params), fetcher, { | |
keepPreviousData: true, | |
}); | |
}; |
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.
반영했습니다!
- camelCase 변경 - params로 묶기 - #867
src/api/attendanceApi.ts
Outdated
todayAttendancePoint: ['todayAttendancePoint'], | ||
todayAttendanceInfo: ({ memberId }: { memberId: number }) => ['todayAttendanceInfo', memberId], | ||
attendanceInfoList: ({ memberId, year }: { memberId: number; year: number }) => [ | ||
'attendanceInfoList', | ||
memberId, | ||
year, | ||
], | ||
todayAttendanceRank: (param: PageAndSize) => [...attendanceKeys.base, 'todayRank', param] as const, |
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.
params
로 해야할 것 같습니당
src/api/attendanceApi.ts
Outdated
const fetcher = () => | ||
axios | ||
.get('/attendances/today-rank', { | ||
params: { page, size }, |
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.
여기도 이렇게 가능할 것 같습니다!
params: { page, size }, | |
params, |
src/api/memberApi.ts
Outdated
memberList: ['member', 'memberList'] as const, | ||
pointRank: (param: PageAndSize) => [...memberKeys.base, 'pointRank', param] as const, |
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.
이것도 params해야합니당!
src/api/memberApi.ts
Outdated
const useGetPointRank = ({ page, size = 10 }: PageAndSize) => { | ||
const params = { page, size }; | ||
|
||
const fetcher = () => axios.get('/members/point-rank', { params: { page, size } }).then(({ data }) => data); |
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.
여기두요!
const fetcher = () => axios.get('/members/point-rank', { params: { page, size } }).then(({ data }) => data); | |
const fetcher = () => axios.get('/members/point-rank', { params }).then(({ data }) => data); |
src/api/memberApi.ts
Outdated
|
||
const memberKeys = { | ||
base: ['member'] as const, | ||
memberList: ['member', 'memberList'] as const, |
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.
여기 base가져오면 될것같습니당!
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.
이 부분은 rank 관련은 아니라서 안건드리긴 했는데 겸사겸사 반영해두겠습니다!
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.
👍
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.
💡
연관 이슈
작업 요약
Rank Api 쿼리키 포멧 통일
작업 상세 설명
리뷰 요구사항
3분