-
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.
- 그렇지만 아직 한줄평 API가 완전하지 않아보임 - 당장 쓰기 어려워보이는 기능은 제거
- Loading branch information
1 parent
7c2404a
commit 975a50d
Showing
4 changed files
with
88 additions
and
17 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 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,31 @@ | ||
import { useMutation } from '@tanstack/react-query'; | ||
import { AxiosRequestConfig } from 'axios'; | ||
import { post } from '~/libs/api'; | ||
|
||
type Request = { | ||
evaluation: number; | ||
}; | ||
|
||
export const postRecommendQueryKey = (reviewId: number) => [ | ||
'recommend', | ||
reviewId, | ||
]; | ||
|
||
const usePostRecommend = (restaurantId: number, reviewId: number) => { | ||
const mutation = useMutation<unknown, Error, Request>({ | ||
mutationFn: (request: Request) => { | ||
const config: AxiosRequestConfig = { | ||
data: request, | ||
}; | ||
|
||
return post<unknown>( | ||
`/restaurants/${restaurantId}/reviews/${reviewId}/`, | ||
config, | ||
); | ||
}, | ||
}); | ||
|
||
return mutation; | ||
}; | ||
|
||
export default usePostRecommend; |