Skip to content

Commit

Permalink
feat: POST /shared/posts/dormitory/{postId}/scrap API (kookmin-sw#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjeongmin committed May 8, 2024
1 parent 3e16162 commit b098436
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/features/shared/shared.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const deleteSharedPost = async (postId: number) =>
await axios.delete<SuccessBaseDTO>(`/maru-api/shared/posts/studio/${postId}`);

export const scrapPost = async (postId: number) =>
await axios.get<SuccessBaseDTO>(
await axios.post<SuccessBaseDTO>(
`/maru-api/shared/posts/studio/${postId}/scrap`,
);

Expand Down Expand Up @@ -152,3 +152,8 @@ export const deleteDormitorySharedPost = async (postId: number) =>
await axios.delete<SuccessBaseDTO>(
`/maru-api/shared/posts/dormitory/${postId}`,
);

export const scrapDormitoryPost = async (postId: number) =>
await axios.post<SuccessBaseDTO>(
`/maru-api/shared/posts/dormitory/${postId}/scrap`,
);
6 changes: 6 additions & 0 deletions src/features/shared/shared.hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
getDormitorySharedPosts,
getSharedPost,
getSharedPosts,
scrapDormitoryPost,
scrapPost,
} from './shared.api';
import {
Expand Down Expand Up @@ -435,3 +436,8 @@ export const useDeleteDormitorySharedPost = ({
onSuccess,
onError,
});

export const useScrapDormitorySharedPost = () =>
useMutation<AxiosResponse<SuccessBaseDTO>, FailureDTO, number>({
mutationFn: scrapDormitoryPost,
});

0 comments on commit b098436

Please sign in to comment.