Im using the following code to approve users on the site when the link is clicked
export function doApproval(token) {
// approve the user
return wixUsers.approveByToken(token)
// user is now active, but not logged in
// return the session token to log in the user client-side
.then( (sessionToken) => {
return {sessionToken, "approved": true};
} )
.catch( (error) => {
return {"approved": false, "reason": error};
} );
}
When the user is approved i would also like to update a field in their contact information.
say its a text field called emailVerified and i want the value to say “Email Verified”
can this be done?
I know there is
export function myBackendFunction(contactId, firstName, lastName, email, phone) {
wixCrm.updateContact(contactId, {
"firstName": firstName,
"lastName": lastName,
"emails": [email],
"phones": [phone]
} )
.then( () => {
// contact has been updated
} )
.catch( (err) => {
// there was an error updating the contact
} );
}
But im not sure how to apply it here