From 658b6caeef1916d61775c38d1363158add176e7b Mon Sep 17 00:00:00 2001 From: hamo-o Date: Wed, 7 Aug 2024 14:13:03 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20API=20=EC=9E=84=EC=8B=9C=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/mutation/usePostOrder.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hooks/mutation/usePostOrder.ts b/src/hooks/mutation/usePostOrder.ts index 789bbad..aace9e1 100644 --- a/src/hooks/mutation/usePostOrder.ts +++ b/src/hooks/mutation/usePostOrder.ts @@ -1,9 +1,13 @@ import { useMutation } from '@tanstack/react-query'; +import { useNavigate } from 'react-router-dom'; import ordersApi from '@/apis/orders/ordersApi'; +import RoutePath from '@/routes/routePath'; const usePostOrder = () => { + const navigate = useNavigate(); const { mutate: postOrder, ...rest } = useMutation({ - mutationFn: ordersApi.POST_ORDER + mutationFn: ordersApi.POST_ORDER, + onError: () => navigate(RoutePath.PaymentsFail) }); return { postOrder, ...rest };