Hi there,
Can you please help me with my below code? I received an error in the console:
"ReferenceError: email is not defined" (Sign in registration line 22)
Thank you
import wixUsers from 'wix-users';
import wixData from 'wix-data';
import wixLocation from 'wix-location';
$w.onReady(function () {
$w("#registerButton").onClick( (event) => {
let email =("#loginEmail").value;
let password = $w("#loginPassword").value;
let first = $w("#firstName").value;
let last = $w("#lastName").value;
let name = $w("#companyName").value;
let number = $w("#phoneNumber").value;
let contemail = $w("#contactEmail").value;
let zip = $w("#citystateButton").value;
let category = $w("#categoryListing").value;
});
wixUsers.register(email, password, { <---------------------Line 22
contactInfo: {
"firstName": firstName,
"lastName": lastName
}
} )
.then( (result) => {
let status = result.status; // "Pending"
let approvalToken = result.approvalToken;
let user = result.user;
} )
.catch( (err) => {
console.log(err);
$w("#errormessage").expand();
} );
} );
import wixUsers from 'wix-users'; import wixData from 'wix-data'; import wixLocation from 'wix-location'; $w.onReady(function () { $w("#registerButton").onClick( (event) => { let email =("#loginEmail").value; let password = $w("#loginPassword").value; let first = $w("#firstName").value; let last = $w("#lastName").value; let name = $w("#companyName").value; let number = $w("#phoneNumber").value; let contemail = $w("#contactEmail").value; let zip = $w("#citystateButton").value; let category = $w("#categoryListing").value; }); ///// <----------------------------- This is the problem, move it below... wixUsers.register(email, password, { contactInfo: { "firstName": firstName, "lastName": lastName } } ) .then( (result) => { let status = result.status; // "Pending" let approvalToken = result.approvalToken; let user = result.user; } ) .catch( (err) => { console.log(err); $w("#errormessage").expand(); } ); } ); } ); ///// <----------------------------- Over here, and delete the one above
you forgot the $w when defining email