Hi all, I’m using register from wix-members-backend to handle a custom registration flow. Registration works fine except the birthdate isn’t saved. I’ve worked around this by sending the birthdate to the confirmation url query params, but surely there’s a way of saving birthdates without doing that.
What am I missing here? My code is as follows:
registration.jsw
export async function doRegistration(email, pw, payload) {
//b is the user's obscured birthdate
const { contactInfo, page, b } = payload
const options = {
contactInfo
}
//create label array
const labelKeys = ["Member label"]
//add labels based on registration answers
if(contactInfo["Custom field 1"] == "yes") {
labelKeys.push("Label 1")
} else {
labelKeys.push("Label 2")
}
if(contactInfo["Custom field 2"] == "yes") {
labelKeys.push("Label 3")
}
options.contactInfo["labels"] = labelKeys
try {
const res = await authentication.register(email, pw, options)
await triggeredEmails.emailMember('confirmationEmail', res.member._id, {
variables: {
//sends a link with the page the user registered from and their obscured birthdate
confirmUrl: `domain/regis-conf?tk=${res.approvalToken}&pg=${page}&b=${b}`
}
})
return res
//----- rest of code -----
register() gets this options object
{
contactInfo: {
firstName: "name",
lastName: "name",
//birthdate IS NOT saved
birthdate: "2021-11-27", //follows the format requested in updateContact
"Custom field 1": "some val",
"Custom field 2": "some val",
labels: ["Member Label", "Custom label 1", "Custom Label 2"]
}
}
Everything is being written to user data except birthdate. Is it the wrong key name? Am I passing the wrong format? Is this a bug?