this is what I got:
Parsing Error:
// $w(“#error”).show();
})
}
}) //Getting a parsing error here why?
})
})
}
})
Whole Code:
import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;
$w.onReady( function () {
$w(‘#createProfileButton’).onClick(() => {
let emails = [];
let labels = [];
emails.push($w('#emailAddress').value);
// register as member using form data
wixUsers.register($w(‘#emailAddress’).value, $w(‘#password’).value, {
“contactInfo”: {
“firstName”: $w(‘#firstName’).value,
“lastName”: $w(‘#lastName’).value,
“userName”: $w(‘#userName’).value,
“emailAddress”: $w(‘#emailAddress’).value,
“phoneNumber”: $w(‘#phoneNumber’).value,
“streetAddress”: $w(‘#streetAddress’).value,
“password”: $w(‘#password’).value,
“City”: $w(‘#City’).value,
“State”: $w(‘#State’).value,
“postalCode”: $w(‘#postalCode’).value,
“referred”: $w(‘#referred’).value,
“referredBy”: $w(‘#referredBy’).value,
“Level”: $w(‘#Level’).value,
“Rules”: $w(‘#Rules’).value,
“emails”: emails,
“labels”: labels,
}
});
$w(“#createProfileButton”).onClick(() => {
let fname = $w(“#firstName”).value;
let lname = $w(“#lastName”).value;
let phone = $w(“#phoneNumber”).value;
let refCode = fname.slice(0, 2).toLocaleLowerCase() + phone.slice(phone.length - 4, phone.length) + lname.slice(0, 2).toLocaleLowerCase();
let toInsert = {
“firstName”: fname,
“lastName”: lname,
“emailAddress”: $w(“#emailAddress”).value,
“phone”: phone,
“username”: $w(“#userName”).value,
“referredBy”: $w(“#referredBy”).value,
//“referralCode”: refCode
};
if (($w(‘#work4us’).checked === true )) {
$w(“#work4us”).value = work4Us
wixData.query("profile") //change this to the name of your database
.eq("work4us", work4Us) //"email is the name of the field in your database, change as necessary"
.descending("_createdDate")
.find()
.then((results) => {
console.log(results);
if (results.items.length > 0) {
let items = results.items;
let firstItem = items[0];
let refCode = firstItem._id
console.log(refCode);
//then just display the refCode on the page something like:
//$w(“#text1”).text = refCode
} **else** {
console.log("no matches found in database")
}
})
}
})
. **catch** ((err) => {
//check error codes and see if taken or not.
let errorMsg = err;
// $w(“#error”).show();
})
}
}) //Getting a parsing error here why?
})
})
}
})
Console Error:
public/pages/v0r3i.js: Unexpected token, expected , (100:0) 98 | }) 99 | } > 100 | }) | ^ 101 | }) 102 | }) 103 | }