Async version of Accounts.urls.* functions

Hi,

I’m currently checking out what parts of my app can already be “asynchronized”. I came across the functions a la Accounts.urls.enrollAccount, Accounts.urls.verifyEmail and Accounts.urls.resetPassword.

I customized those with (sync) functions in which I fetch stuff from the users collection.
If I now exchange those db requests to their async versions, I obviously need to make that function async aswell. But of course now a Promise is returned instead of the desired string, so I guess there should be something like Accounts.urls.enrollAccountAsync or so…

Accounts.urls.enrollAccount = async function enroll(token) {
  const tokenUser = await Meteor.users.findOneAsync({
    "services.password.enroll.token": token,
  });

  // get some other stuff like the users tenancyId or something else
  return Meteor.absoluteUrl(
    "enroll-user/" +
      token + "/tenancyId/" + tenancyId)
  );
};

Is this already there or planned?

1 Like