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

@ -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"