import wixusers from ‘wix-users’ ;
import wixlocation from ‘wix-location’
import wixwindow from ‘wix-window’ ;
import wixdata from ‘wix-data’ ;
let registration;
$w.onReady( function () {
$w( ‘#registrationButton’ ).onClick((event)=>{
console.log( “Button was Clicked” );
$w( ‘#errorMessage’ ).hide();
$w( ‘#emailExists’ )
if ($w( “#email” ).valid && $w( “#password” ).valid) && $w( “#firstname” ).valid && $W( “#lastname” );
let email = $w( “#email” ).value
let password = $w( “#password” ).value
let first = $w( ‘#firstname’ ).value
let last = $w( “#lastname” ).value
wixusers.register(email, password, {
contactinfo:{
“firstname” : first,
“lastname” : last
}
})
.then((result) =>){
$w( “#SuccessMessgae” ).show();
setTimeout(() => {
$w( ‘#SuccessMessgae’ ).hide();
}, 3500 );
$w( “#email” ).placeholder = “email” ;
$w( “#password” ).placeholder = “password” ;
$W( “#firstname” ).placeholder = “first name” ;
$w( “#lastname” ).placeholder = “last name” ;
$w( “#email” ).value = “” ;
$w( “#password” ).value = “” ;
$w( “#firstname” ).value = “” ;
$w( “#lastname” ).value = “” ;
})
. catch ((err) =>{
let errMsg = err;
console.log(err);
$w( ‘#emailExists’ ).show();
});
console.log( “trying to register” );
} else {
$w( ‘#errorMessage’ ).show();
console.log( “Missiong Information” );
}
});
});