I made a custom signup form using this guide from wix, however I seem to be having a hard time adding address to the user from the addressInput, without the addressInput it works just fine.
import { authentication } from 'wix-members';
//the wix api requires that both emails and labels are passed in as arrays
let emails = [];
let labels = [];
let phones = [];
$w.onReady(function () {
$w('#submit').onClick(() => {
const firstName = $w('#firstName').value
const lastName = $w('#lastName').value
const email = $w('#email').value
const phone = $w('#phone').value
const gender = $w('#gender').value
const role = $w('#role').value
const password = $w('#password').value
const address = $w('#address').value
emails.push(email)
labels.push(role)
phones.push(phone)
// Add labels/roles
console.log($w('#address'))
let options = {
contactInfo: {
firstName: firstName,
lastName: lastName,
emails: emails,
phones: phones,
labels: labels,
address:address
},
privacyStatus: 'PUBLIC'
}
authentication.register(email, password, options)
.then((registrationResult) => {
const status = registrationResult.status;
// When the site is configured for automatic approval, status is "ACTIVE" and the member is approved and logged in.
console.log('Member registered and logged in:', registrationResult);
})
.catch((error) => {
console.error(error);
});
});
});