Retrieves the currently logged-in member.
The getMember()
function returns a Promise that resolves
to the currently logged-in member, or undefined
if a member isn't logged in.
Notes:
CurrentMember
are only partially functional when previewing your site. View a published version of your site to see their complete functionality.function getMember(options: FieldsetOptions): Promise<Member>;
Fieldset options.
import { currentMember } from "wix-members-frontend";
// ...
// Sample options value:
// {
// fieldsets: [ 'FULL' ]
// }
currentMember
.getMember(options)
.then((member) => {
const id = member._id;
const fullName = `${member.contactDetails.firstName} ${member.contactDetails.lastName}`;
return member;
})
.catch((error) => {
console.error(error);
});
/* Promise resolves to:
* {
* "_id": "f32cbc51-a331-442b-86c2-2c664613e8b9",
* "_createdDate": "2021-08-02T23:14:42Z",
* "_updatedDate": "2021-08-02T23:14:58.345Z",
* "lastLoginDate": "2021-08-12T19:46:33Z",
* "loginEmail": "claude.morales@example.com",
* "contactId": "f32cbc51-a331-442b-86c2-2c664613e8b9",
* "status": "APPROVED",
* "privacyStatus": "PRIVATE",
* "activityStatus": "ACTIVE",
* "profile": {
* "nickname": "Claude Morales",
* "slug": "claudemorales",
* "profilePhoto": {
* "url": "//static.wixstatic.com/media/a27d24_0dd318~mv2.jpg",
* "height": 256,
* "width": 256,
* "offsetX": 1,
* "offsetY": 1
* },
* "coverPhoto": {
* "url": "https://example.com/myimage.jpg",
* "height": 1080,
* "width": 1920,
* "offsetX": 1,
* "offsetY": 1
* },
* "title": "Awesome title"
* },
* "contactDetails": {
* "firstName": "Claude",
* "lastName": "Morales",
* "phones": [
* "0747-769-460"
* ],
* "emails": [
* "claude.morales@example.com"
* ],
* "addresses": [
* {
* "country": "GB"
* },
* {
* "_id": "f0f4d905-488d-44db-9080-fc29078cfad5",
* "addressLine": "9373 Park Avenue",
* "addressLine2": "Berkshire",
* "city": "Ely",
* "subdivision": "GB-ENG",
* "country": "GB",
* "postalCode": "PD50 8EU"
* }
* ],
* "customFields": {
* "custom.pronouns": {
* "name": "Pronouns",
* "value": "they/them"
* },
* "custom.nickname": {
* "name": "Nickname",
* "value": "Cee"
* }
* }
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.