Member login error

I’m having an issue authenticating members to the website. When I create new test members using other credentials, the member ID I keep getting upon their logging on is mine (me being the webmaster). I’m using the standard authentication method as described in the Wix Help manual.

authentication . promptLogin ({ mode : ‘login’ , modal : true })
. then (() => {
currentMember . getMember ({ fieldsets : [ ‘FULL’ ] })
. then (( member ) => {
console.log ( member . _id );

Whatever member I log in with, the function always returns my member ID. I tried emptying the cache, but no go. I’m using the latest Chrome.

authentication.promptLogin({ mode: 'login', modal: true })
.then(() => currentMember.getMember({ fieldsets: [ 'FULL' ] }))
.then(member => {
console.log(member._id);
})

Thanks, The closing brackets are already there in my code. I only copied the first part which seems to have the issue.

@internationalcovidsu You’re welcome.
Always remember to chain promises and not to nest them. meaning: never have a .then(){} inside another ,then(){}.

@jonatandor35 So how would I rewrite the above?

So, here’s an update. When I use the function…

currentMember.getMember(options)
11  .then((member) => {
12    const id = member._id;
13    const fullName = `${member.contactDetails.firstName} ${member.contactDetails.lastName}`;
14    return member;
15  })
16  .catch((error) => {
17    console.error(error);
18  });

…it returns the wrong user. I tried reverting to the deprecated function…

import wixUsers from 'wix-users';
2
3// ...
4
5let user = wixUsers.currentUser;
6
7let userId = user.id;           // "r5cme-6fem-485j-djre-4844c49"
8let isLoggedIn = user.loggedIn; // true

…and it works like a charm! No idea why though.