Hi,
I built a customized registration with additional fields. Registration works great, but when user updates the profile in the customized member area, the updateUserInfo() ends with success, but the contact is not updated.
Any idea?
$w('#submit').onClick(() => {
$w("#err").hide();
$w("#success").hide();
wixUsers.currentUser.getEmail()
.then((email) => {
let userInfo = {
"firstName": $w('#first').value,
"lastName": $w('#last').value,
"picture": $w('#image').src,
"nickname": $w('#nick').value,
"phones": [$w('#phone').value],
"fbLink": $w('#facebook').value,
"dateOfBirth": $w('#birth').value,
"gender": $w('#gender').value,
"orientation": $w('#orientation').value
};
updateUser(userId, userInfo)
.then(() => {
$w("#success").show();
console.log("user saved")
})
.catch((err) => {
console.log(err);
$w("#err").show();
});
});
});
And this is the backend code:
export function updateUser(userId, contact) {
return wixUsers.updateUserFields(userId, contact)
.catch((err) => {
function log() {
wixData.insert("log", { "title": err });
}
});
}
Thanks a lot:)
Dafna