Member registration through Velo not working

Hi, I’ve been trying to add a custom registration through Velo and have gone through the tutorials. But somehow it’s not working. I am using a Lightbox to receive details and the standard registration code for creating new members. The Lightbox closes correctly after the submit button is clicked but a new member is not registered. There is no data that is passed to the members data collection.

My code is as follows

import wixUsers from ‘wix-users’ ;
import wixWindow from ‘wix-window’ ;

$w . onReady ( function () {
$w ( ‘#submit’ ). onClick ( () => {
let firstName = $w ( ‘#firstName’ ). value ;

let lastName = $w ( ‘#lastName’ ). value ;
let email = $w ( ‘#email’ ). value ;
let password = $w ( ‘#password’ ). value ;

let emails = ;
emails . push ( $w ( ‘#email’ ). value );

        wixUsers . register ( email ,  password , { 
                contactInfo : { 

“firstName” : firstName ,
“lastName” : lastName ,
“emails” : emails ,
}
} );
wixWindow . lightbox . close ();
});
});

Similar post, look here…
https://www.wix.com/velo/forum/coding-with-velo/redirect-users-on-sign-up

@russian-dima thanks for replying. I checked out the link you’ve shared. But I’m not struggling with redirection. I’m trying the most basic version of registration. I’ve made the Lightbox for signup, have named all element IDs correctly and have new members on auto approve. I’ve used the above code. I am not getting any error… it’s just that member registrations are not happening. I’m not really sure what am I missing or doing wrong.

@anupamtrivedi
Always try to read given information carefully.
All needed information you normaly should be able to find inside the given post-link.

Before you start to code something more complex, do start always simple, for example like this one…

import wixUsers from 'wix-users';
import wixWindow from 'wix-window';

$w.onReady(function(){
   $w('#submit').onClick(()=>{console.log("Submit-Button clicked")
      let firstName = $w('#firstName').value;
      let lastName = $w('#lastName').value;
      let email = $w('#email').value;
      let password = $w('#password').value; 
 
      wixUsers.register(email, password, {
         contactInfo: {
            "firstName": firstName,
            "lastName": lastName,
         }
      })
      .then((result)=>{console.log("RESULTS: ", result); 
         wixWindow.lightbox.close();
      }); 
   });
});