I am working on a project that involves a small number of users; not more than 10 for now. There are only three users so far, including me, to test functionality. I approve the sign up and then Wix creates the user information. I then simply copy/paste the Id text into a dbUsers that I created using the content editor (I suspect that this might be the problem). I store in a field titled Wix Id. The dbUsers includes information about the user beyond what’s asked for in the sign-up forms.
When I query the dbUSers comparing the currentUser.id with the wixid copy/pasted in the table, it does not return anything, even though when I console.log both items they look exactly the same in the console.
Is there a transformation to both values that will generate a positive compare result?
Code included below.
Many thanks.
export function getUserInfo ( ) {
activeUserId = wixUsers . currentUser . id ;
console . log ( activeUserId );
wixData . query ( "dbUsers" )
. eq ( "wixId" , activeUserId )
. limit ( 1 )
. find ()
. then ( results => {
console . log ( results . items [ 0 ]. wixId );
**if** ( activeUserId === results . items [ 0 ]. wixid ) {
console . log ( "user Id checks." );
}
**else** {
console . log ( "User Id does not check." );
}
//userName = results.items[0].userName;
//userCo = results.items[0].userCompany;
})
//console.log(userName + " - " + userCo);
}