-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #167 from KNU-HAEDAL/Fix/issue-#161
내 챌린지 기록 리스트 보기 페이지 수정
- Loading branch information
Showing
4 changed files
with
153 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { ChallengeResponse } from './getReview.response'; | ||
import { axiosClient } from '@/apis/AxiosClient'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
const getReviewPath = () => '/api/challengeGroups/reviews'; | ||
|
||
const ReviewQueryKey = [getReviewPath()]; | ||
|
||
const getReview = async ( | ||
page: number, | ||
size: number | ||
): Promise<ChallengeResponse> => { | ||
const response = await axiosClient.get(getReviewPath(), { | ||
params: { | ||
page, | ||
size, | ||
}, | ||
}); | ||
return response.data; | ||
}; | ||
|
||
export const useGetReview = (page: number, size: number) => { | ||
return useQuery<ChallengeResponse, Error>({ | ||
queryKey: [ReviewQueryKey, page, size], | ||
queryFn: () => getReview(page, size), | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import ApiResponse from '@/apis/ApiResponse'; | ||
|
||
export type ChallengeUser = { | ||
id: number; | ||
nickname: string; | ||
profileImageUrl: string; | ||
tierInfo: { | ||
tier: string; | ||
totalExp: number; | ||
currentExp: number; | ||
}; | ||
}; | ||
|
||
export type ChallengeData = { | ||
challengeId: number; | ||
challengeTitle: string; | ||
user: ChallengeUser; | ||
content: string; | ||
rating: number; | ||
}; | ||
|
||
export type ChallengeResponseData = { | ||
totalPage: number; | ||
hasNext: boolean; | ||
data: ChallengeData[]; | ||
}; | ||
|
||
export type ChallengeResponse = ApiResponse<ChallengeResponseData>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters