🤫 수정 전


☺️ 수정 후

const delegateSchema = (amountMax: number) => {
  return yup.object().shape({
    stadiumOwnerId: yup.string().required(`SO is not selected`),
    amount: yup
      .number()
      .required(`Enter the amount to be sent`)
      .min(1, `You can enter within the amount available.`)
      .max(amountMax, `You can enter within the amount available.`),
  });
};

const {
    handleSubmit,
    control,
    setValue,
    watch,
    formState: { isValid },
  } = useForm<DelegateFormData>({
    mode: `onChange`,
    resolver: yupResolver(delegateSchema(amount ? sliceAmount(amount, 5) : 0)),
  });