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 }; diff --git a/src/pages/PaymentsSuccess.tsx b/src/pages/PaymentsSuccess.tsx index 865089b..403482a 100644 --- a/src/pages/PaymentsSuccess.tsx +++ b/src/pages/PaymentsSuccess.tsx @@ -1,6 +1,6 @@ import { useEffect } from 'react'; import { useNavigate, useSearchParams } from 'react-router-dom'; -import { Flex, Text } from '@/components/common/Wrapper'; +import { Flex, Text, Space } from '@/components/common/Wrapper'; import { media } from '@/styles'; import styled from '@emotion/styled'; @@ -47,8 +47,8 @@ export function PaymentsSuccess() { }, [searchParams]); return ( - - + + 회비 결제 완료 @@ -57,7 +57,10 @@ export function PaymentsSuccess() { 이제 GDSC 정회원으로 이번 학기에 활동하실 수 있어요! - + + + + ); }