import { useNavigate } from 'react-router' import { RejectPopup as RejectPopupForm } from '@/components' import { getApiErrorMessage, useRejectMutation } from '@/apis' import { toast } from '@/lib' import { useChatStore } from '@/features/chat/stores/useChatStore' import { useChatInitStore } from '@/features/chat/stores/useChatInitStore' // 협상 진행 중 거부 — 폼은 목록 거부와 공용이고, 여기서는 대화 세션에 붙여 제출·이탈만 처리한다. export function RejectPopup({ onClose }: { onClose: () => void }) { const navigate = useNavigate() const reject = useRejectMutation() const sessionId = useChatStore((s) => s.sessionId) const itemVatYn = useChatInitStore((s) => s.item_vat_yn) return ( reject.mutate( { sessionId, request }, { onSuccess: () => { onClose() toast.warning('협상 거부가 완료되었습니다.') navigate('/list') }, onError: (error) => toast.error(getApiErrorMessage(error, '거부 처리에 실패했습니다.')), }, ) } /> ) }