'use client'; import { useQuery, useMutation } from '@tanstack/react-query'; import { useRouter } from 'next/navigation'; import { useForm } from 'react-hook-form'; import { getFedexCodes, insertFedex } from '@/lib/api/fedex'; import { useToast } from '@/components/common/Toast'; interface FormValues { ieGbn: string; sCode: string; sYear: string; sJechl: string; comNm: string; jSingoDt: string; sSingoDt: string; jGwiCd: string; fStCd: string; fJjCd: string; fJjContents: string; fJjNm: string; fJjRegDt: string; fJjRegGbn: string; } export default function Fedex0010WritePage() { const router = useRouter(); const { success, error: toastError } = useToast(); const { data: codes } = useQuery({ queryKey: ['fedex', 'codes'], queryFn: getFedexCodes, }); const { register, handleSubmit, formState: { errors } } = useForm({ defaultValues: { fJjRegGbn: '1' }, }); const saveMut = useMutation({ mutationFn: (data: FormValues) => insertFedex(data as Record), onSuccess: (sq) => { success('등록되었습니다.'); router.push(`/fedex/0010/${sq}`); }, onError: () => toastError('등록 중 오류가 발생했습니다.'), }); return (

수입정정 등록

saveMut.mutate(d))} className="space-y-4">
{errors.comNm &&

{errors.comNm.message}

}