N
N
Neuro2019-04-26 12:20:12
Node.js
Neuro, 2019-04-26 12:20:12

How to return util.promisify promise?

Guys, tell me how can I rewrite this function so that it would return a promise using util.promisify?

app.models.location.getLocationByUrlSlug(urlslug, (err, location) => {
    if (err) {
      log("Error %o", err);
      return ctx.reply(ctx.i18n.__(`Please try again later`));
    }
    if (!location) {
      return ctx.reply(ctx.i18n.__(`Requested service is not found`));
    }
    ctx.session.location = location.__data;
    ctx.session.locationId = location.id;
)}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question