Send multiple form submission email in same page | URGENT

Hello Wix,

My problem is that I have two forms in the same page and I want to send one email for each form if it’s filled, I wrote a code and it works well (it sends an email with the submitted data ), but I’m facing a small issue which is receiving two emails (one of them is full and the other is empty for the second form that is not filled)

How to edit the code to send only one email for the filled form.

import {sendEmail,sendEmailWithRecipient} from ‘backend/email’ ;

$w.onReady( function () {
$w( “#dataset2” ).onAfterSave(sendFormData);
$w( “#dataset3” ).onAfterSave(sendFormData);
});

function sendFormData(){
{ const subject = Submission sucssful ${$w( "#FirstName" ).value};
const body =
New client: ${$w( "#FirstName" ).value} \rFirst name: ${$w( "#FirstName" ).value} \rLast name: ${$w( "#LastName" ).value} \rEmail: ${$w( "#Cemial" ).value} \rPhone number: ${$w( "#PhoneNumber" ).value} \rCategory: ${$w( "#Category" ).value} \rNumber of photos/videos: ${$w( "#Quantity" ).value} \rVideo Length: ${$w( "#VideoLength" ).value} \rDate: ${$w( "#Date" ).value} \rLocation: ${$w( "#Location" ).value} \rRefrence: ${$w( "#UrlReference" ).value} \rImage refrence: ${$w( "#upload" ).value} \rDescription: ${$w( "#Description" ).value};
const recipient = $w( “#PhoneNumber” ).value;

sendEmailWithRecipient(subject, body, recipient)
.then(response => console.log(response));

sendEmail(subject, body)
.then(response => console.log(response));
}
{ const subject = Submission sucssful (previuos client) ;
const body =
\rEmail: ${$w( "#email2" ).value} \rCategory: ${$w( "#Category2" ).value} \rNumber of photos/videos: ${$w( "#Quantitiy2" ).value} \rVideo Length: ${$w( "#vlength2" ).value} \rDate: ${$w( "#sDate2" ).value} \rLocation: ${$w( "#sLocation2" ).value} \rRefrence: ${$w( "#URLref2" ).value} \rImage refrence: ${$w( "#imageRef2" ).value} \rDescription: ${$w( "#description2" ).value};
const recipient = $w( “#email2” ).value;

sendEmailWithRecipient(subject, body, recipient)
.then(response => console.log(response));

sendEmail(subject, body)
.then(response => console.log(response));
}

}