In this example I try to log the status of the result from a call to wixUsers.register().
Here is the code:
import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
import wixData from 'wix-data';
$w.onReady(function () {
$w('#submit').onClick( () => {
let emails = [];
emails.push($w('#inputEmail').value);
// register as member using form data
wixUsers.register($w('#inputEmail').value, $w('#inputPassword').value, {
"contactInfo": {
"firstName": $w('#inputFirstname').value,
"lastName": $w('#inputLastname').value
}
}).then( (result) => {console.log(result.status)})
.catch( (error) => {console.log(error)})
});
});
Note that errors do get caught and logged. For example, if I try to register an already exisiting email I get a 403.
But, if I try to register a new email I get a 500. And this doesn’t make sense because when I check the Members collection, the new user is there. This stops me from being able to do more interesting things within the then() because that seems to be skipped altogether.