Having this API call extracted from the documentation. And trying to read 2 custom fields.
export function myGetProfile() {
return currentMember.makeProfilePublic()
.then((profile) => {
let tblCustom = null;
tblCustom = profile.contactDetails.customFields;
console.log("custom tbl= " + JSON.stringify(tblCustom));
// {"custom.type-de-membre":{"name":"Type de membre","value":"Auxiliaire"},"custom.groupe":{"name":"groupe","value":"Membre"}}
return profile;
})
.catch((error) => {
console.error(error);
});
}
this is what the console.log is returning
//{"custom.type-de-membre":{"name":"Type de membre","value":"Auxiliaire"},"custom.groupe":{"name":"groupe","value":"Membre"}}
unable to figure out , how can I read the 2 custom field’s value.
I tried with the following code with no success as the pre-compiler is thinking I am doing an arithmetic calculation: the dash are part of the field name generated by Wix.
let a = tblCustom.custom.type-de-membre.value;