Custom Registration help

I want to create a custom user, when I click the button it does not do any action. Can anyone help?

import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;
// …
$w(‘#buttonregister’).onClick( () => {
wixUsers.register($w(‘#email’).value, $w(‘#password’).value, {
contactInfo: {
“firstName”: $w(‘#firstName’).value,
“lastName”: $w(‘#lastName’).value,
“emails”: $w(‘#email’).value,
“phone”: $w(‘#phone’).value,
“birthday”: $w(‘#birthday’).value,
}
} )
.then( (result) => {
let status = result.status; // “Active”
let user = result.user;
wixLocation.to(“/account/customer”);
} );

});

try adding some console logs before and after the user registration. Log each input value to make sure you are passing valid info. After the then function console log a success message.

Note as far as i am aware the user registration will not add users to the CRM in preview mode, you have to be on the live site for that.