Meteor.user() undefined in ionic app components


#1

Hello,

I am running the following code in app.components.ts in Ionic:

Meteor.startup(() => {
  const subscription = MeteorObservable.autorun().subscribe(() => {
    if (Meteor.loggingIn()) {
      return;
    }
    console.log("Subscription.unsubscribe in bootstrap");
  });
});

After I run this, I do a check if Meteor.user() exists, but somehow keep getting ‘undefined’. While the code does return true if I run Meteor.loggingIn(). But when I call Meteor.userId(), I do get the userId.

How can this be the case and does anyone know what I might be doing wrong in this case? For what I am building, I would require to retrieve Meteor.user().

Thanks in advance.