diff --git a/src/CreateBook/hooks/usePostBook.ts b/src/CreateBook/hooks/usePostBook.ts index b60f4561..9519282a 100644 --- a/src/CreateBook/hooks/usePostBook.ts +++ b/src/CreateBook/hooks/usePostBook.ts @@ -30,6 +30,10 @@ const usePostBook = () => { }); }, onError: () => navigate('/error'), + onSuccess: (data) => { + const { bookUuid } = data; + navigate(`/lecue-book/${bookUuid}`); + }, }); return mutation; }; diff --git a/src/CreateBook/page/index.tsx b/src/CreateBook/page/index.tsx index 8c57eb1d..046d1a46 100644 --- a/src/CreateBook/page/index.tsx +++ b/src/CreateBook/page/index.tsx @@ -28,14 +28,13 @@ function CreateBook() { const postMutation = usePostBook(); const handleClickCompleteModal = async () => { - const bookUuid = postMutation.mutate({ + postMutation.mutate({ favoriteName: name, favoriteImage: presignedFileName, title: title, description: description, backgroundColor: backgroundColor, }); - navigate(`/lecue-book/${bookUuid}`); }; return postMutation.isLoading ? (