This used to work any ideas?
code:
import wixData from 'wix-data'; import wixLocation from 'wix-location'; import wixUsers from 'wix-users'; $w.onReady(function () { $w('#createProfileButton').onClick(() => { if (($w('#work4us').checked === true)) { let refCode = fname.slice(0, 2).toLocaleLowerCase() + phone.slice(phone.length - 4, phone.length) + lname.slice(0, 2).toLocaleLowerCase(); } let fname = $w("#firstName").value; let lname = $w("#lastName").value; let phone = $w("#phoneNumber").value; let emails = []; let labels = []; let toInsert = { "firstName": fname, "lastName": lname, "emailAddress": $w("#emailAddress").value, "phone": phone, "username": $w("#userName").value, "referredBy": $w("#referredBy").value, }; wixData.insert("profile", toInsert) .then(() => { wixLocation.to("/account/profile-page"); emails.push($w('#emailAddress').value); // register as member using form data wixUsers.register($w('#emailAddress').value, $w('#password').value, { "contactInfo": { "firstName": $w('#firstName').value, "lastName": $w('#lastName').value, "emailAddress": $w('#emailAddress').value, "phoneNumber": $w('#phoneNumber').value, "streetAddress": $w('#streetAddress').value, "password": $w('#password').value, "City": $w('#City').value, "State": $w('#State').value, "postalCode": $w('#postalCode').value, "referred": $w('#referred').value, "referredBy": $w('#referredBy').value, "Level": $w('#Level').value, "Rules": $w('#Rules').value, "emails": emails, "labels": labels, } }) }) }); });
Thanks everyone!