Cue
April 30, 2022, 12:01am
1
Tried to pull isloggedIn user status from the backend but it always returns as false even though I am logged in. Please what could be the issue?
import wixUsersBackend from 'wix-users-backend';
let user = wixUsersBackend.currentUser;
let userId = user.id;
let isLoggedIn = user.loggedIn;
wixUsersBackend has been deprecated and replaced with wix-Members-backend.currentMember,
As it returns a promise you’ll need to handle that as well.
import { currentMember } from 'wix-members-backend'
return currentMember.getMember(options)
.then((member) => {
let isLoggedIn = true;
let userId = member._id;
}
})
.catch((error) => {
return (error);
})
Hope it helps.
Cue
April 30, 2022, 12:56pm
3
Cue
April 30, 2022, 12:58pm
4
@doug-antill is it possible for a user that is not on the site to do a GET request that will return if the user is logged in or not or does the session log prevent that?