Skip to content

Commit

Permalink
fix: POST reviews 성공시 성공알림 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
not-using committed Jul 18, 2023
1 parent 9673631 commit 04f955c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/api/reviews/usePostReview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ type Props = {
export const usePostReview = ({ bookInfoId, resetTab }: Props) => {
const [content, setContent] = useState("");

const { addErrorDialog } = useNewDialog();
const { addDialogWithTitleAndMessage, addErrorDialog } = useNewDialog();

const displaySuccessAndResetTab = () => {
const title = "성공적으로 등록되었습니다";
addDialogWithTitleAndMessage(title, title, "", resetTab);
};

const request = () =>
axiosPromise("post", "/reviews", {
bookInfoId,
content,
})
.then(resetTab)
.then(displaySuccessAndResetTab)
.catch(addErrorDialog);

return { content, setContent, request };
};

0 comments on commit 04f955c

Please sign in to comment.