-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : 지도 편지 상세 조회 답장 리스트 api 연동 (#319)
* chore : 타입명 수정 * feat : 지도 편지 상세 조회 답장 리스트 api 연동 * feat : 지도 편지 상세 조회 답장 리스트 데이터 바인딩 * chore : 지도 편지 상세 조회 답장 리스트 타입 수정 * fix : 빌드 에러 수정 * fix : letterId 빌드 에러 수정 * chore : 스토리북 삭제
- Loading branch information
Showing
11 changed files
with
106 additions
and
195 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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { getMapReplyList } from '@/service/MapLetter/getMapReplyList'; | ||
import { ReplyListResponseType } from '@/types/letter'; | ||
|
||
type MapReplyListRequestProps = { | ||
letterId: number; | ||
page?: number; | ||
size?: number; | ||
}; | ||
|
||
export const useGetMapReplyList = ({ | ||
letterId, | ||
page, | ||
size | ||
}: MapReplyListRequestProps) => { | ||
return useQuery<ReplyListResponseType, Error>({ | ||
queryKey: ['getMapReplyList', letterId, page, size], | ||
queryFn: async () => { | ||
const response = await getMapReplyList({ | ||
letterId, | ||
page, | ||
size | ||
}); | ||
return response.result || { content: [] }; | ||
}, | ||
enabled: !!letterId | ||
}); | ||
}; |
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,26 @@ | ||
import { defaultApi } from '@/service/api'; | ||
import { ApiResponseType } from '@/types/apiResponse'; | ||
import { ReplyListResponseType } from '@/types/letter'; | ||
|
||
type MapReplyListRequestProps = { | ||
letterId: number; | ||
page?: number; | ||
size?: number; | ||
}; | ||
|
||
type MapReplyListResponse = ApiResponseType<ReplyListResponseType>; | ||
|
||
export async function getMapReplyList({ | ||
letterId, | ||
page, | ||
size | ||
}: MapReplyListRequestProps): Promise<MapReplyListResponse> { | ||
const api = defaultApi(); | ||
const response = await api.get<MapReplyListResponse>( | ||
`/map/${letterId}/reply`, | ||
{ | ||
params: { page, size } | ||
} | ||
); | ||
return response.data; | ||
} |
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
Oops, something went wrong.