Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

314
Vistas
Wix currentMember.getMember() returning undefined

I have a custom Wix profile page (made with Velo) that displays the user's information. To get that information, I have to query a database, and to query that database I have to get the currently logged in user's login email address. Fortunately, Wix has an API for that, currentMember. However, using currentMember.getMember() is returning undefined on the profile page. But after I reload the profile page, it returns an object with the correct member data (including the email I need). Why is this happening? Another thing I noticed is that I'm getting the following error in the console:

the error I'm getting

I was thinking that since the error said the URL was preloaded, perhaps the page loaded before I logged in, and thus the member object being returned is undefined, since the user hadn't logged in yet.

Here is the code I used to log the member object to the console:

import { currentMember } from 'wix-members';

$w.onReady(function () {
currentMember.getMember()
    .then((member) => {
        console.log(member);
    });
 }

And this was logging undefined, but when I reload, it gives the correct info.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I had a similar issue whereby a member logs in, but member object returned was not available until a refresh of the page occurred.

I solved this with the use of the "wix-members" onLogin() api. Below is the code I hacked together.

authentication.onLogin((memberInfo) => {
    const memberId = memberInfo.id;

    if (memberId) {
        console.log("MEMBER ID: " + memberId);
        local.setItem("auth", memberId);
    } else {
        currentMember.getMember()
            .then((member) => {
                if (member) {
                    console.log("MEMBER ID: " + member._id);
                    local.setItem("auth", member._id);
                }
                else {
                    console.log("NOT LOGGED IN!");
                }
            })
            .catch((error) => {
                console.error(error);
            });
    }
});

I had to use an if / else as the memberInfo.id property always appears undefined. I left it in the code (for my use case) in case it begins to work as expected again.

I used this in the masterPage.js onReady().

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda