I’m just getting started on the journey of using Velo to enhance our users experience and I’ve fallen at one of the first hurdles!
All I’m trying to do at the moment is get the current user. Here’s the code which is pretty much a straight crib from Velo reference on getMember:-
import { currentMember } from ‘wix-members’ ;
$w . onReady ( function () {
currentMember . getMember ({ fieldsets : [ ‘FULL’ ]})
. then (( member ) => {
console . log ( member );
const id = member . _id ;
console . log ( id );
**const** loggedIn = member ? **true** : **false** ;
**const** loginEmail = member . loginEmail ;
const fullName = ${ member . contactDetails . firstName } ${ member . contactDetails . lastName }
;
console . log ( fullName );
const contactEmails = member . contactDetails . emails ;
})
. catch (( error ) => {
console . error ( error );
});
In the console log member is returned as Undefined and when I try to reference member._id I get the error message Cannot read properties of undefined (reading ‘_id’).
I can’t help feeling it must be incredibly simple and I’m equally sure I’m going to feel incredibly dumb but your help would be gratefully received.
Thanks
Doug