fixing required

This commit is contained in:
Narul Hidayah
2025-04-16 02:04:12 +07:00
parent d422c05894
commit 81c84dc1cd
2 changed files with 14 additions and 5 deletions

View File

@ -21,6 +21,10 @@ const TransactionDisbursement = () => {
const handleSubmit = async (e: any) => {
e.preventDefault();
console.log('Submitted Data:', form);
if (form.amount == '' || form.customerId == '' || form.pin == '') {
toast.warning('Please fill in all required fields.')
return
}
try {
// let requestTopup = await PostData(`${API_URL}/transaction/request-topup`, {
// amount: form.topupAmount,
@ -64,7 +68,7 @@ const TransactionDisbursement = () => {
{/* form */}
<form onSubmit={handleSubmit} className="space-y-6">
<div>
<label htmlFor="customerId">Customer ID</label>
<label htmlFor="customerId">Customer ID</label><span className="text-red-500">*</span>
<Input
id="customerId"
value={form.customerId}
@ -72,7 +76,7 @@ const TransactionDisbursement = () => {
/>
</div>
<div>
<label htmlFor="amount">Amount</label>
<label htmlFor="amount">Amount</label><span className="text-red-500">*</span>
<Input
id="amount"
type="number"
@ -81,7 +85,7 @@ const TransactionDisbursement = () => {
/>
</div>
<div>
<label htmlFor="pin">PIN</label>
<label htmlFor="pin">PIN</label><span className="text-red-500">*</span>
<Input
id="pin"
type="password"

View File

@ -20,6 +20,11 @@ const TransactionTopup = () => {
const handleSubmit = async (e: any) => {
e.preventDefault();
console.log('Submitted Data:', form);
if (form.pin == '' || form.topupAmount) {
toast.warning('Please fill in all required fields.')
return
}
try {
let requestTopup = await PostData(`${API_URL}/transaction/request-topup`, {
amount: form.topupAmount,
@ -62,7 +67,7 @@ const TransactionTopup = () => {
{/* form */}
<form onSubmit={handleSubmit} className="space-y-6">
<div>
<label htmlFor="topupAmount">Topup Amount</label>
<label htmlFor="topupAmount">Topup Amount</label><span className="text-red-500">*</span>
<Input
id="topupAmount"
type="number"
@ -71,7 +76,7 @@ const TransactionTopup = () => {
/>
</div>
<div>
<label htmlFor="pin">PIN</label>
<label htmlFor="pin">PIN</label><span className="text-red-500">*</span>
<Input
id="pin"
type="password"