-
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 : merit Api querykey factor #874
The head ref may contain hidden characters: "feature/meritApi_\uCFFC\uB9AC\uD0A4_\uD3EC\uB9F7_\uD1B5\uC77C_#865"
Changes from 1 commit
d75d3e2
8a587fa
387200f
0311524
074414b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,11 @@ import axios from 'axios'; | |
import { PageAndSize, MeritLog, MeritType, MembersMerit } from './dto'; | ||
|
||
const meritKeys = { | ||
meritLog: (param: PageAndSize & { meritType?: string }) => ['meritLog', param] as const, | ||
meritType: (param: PageAndSize) => ['meritType', param] as const, | ||
membersMerit: (param: PageAndSize) => ['membersMerit', param] as const, | ||
memberMerit: (param: PageAndSize & { memberId: number }) => ['memberMerit', param] as const, | ||
base: ['merits'] as const, | ||
meritLog: (param: PageAndSize & { meritType?: string }) => [...meritKeys.base, param] as const, | ||
meritType: (param: PageAndSize) => [...meritKeys.base, 'types', param] as const, | ||
membersMerit: (param: PageAndSize) => [...meritKeys.base, 'members', param] as const, | ||
memberMerit: (memberId: number, param: PageAndSize) => [...meritKeys.base, 'members', memberId, param] as const, | ||
}; | ||
|
||
const useGetMeritLogQuery = ({ page, size = 10, meritType = 'ALL' }: PageAndSize & { meritType?: string }) => { | ||
|
@@ -56,7 +57,7 @@ const useGetMemberMeritQuery = ({ page, size = 10, memberId }: PageAndSize & { m | |
}) | ||
.then(({ data }) => data); | ||
|
||
return useQuery<MeritLog>(meritKeys.memberMerit({ page, size, memberId }), fetcher, { | ||
return useQuery<MeritLog>(meritKeys.memberMerit(memberId, { page, size }), fetcher, { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. 반영했습니다 |
||
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.
param
->params
로 변경해주세요~!
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.
반영했습니다!