0

Below is my helper function

async function getPriorityList(operatorId) {
  let result = await Api.getApisDetail(operatorId);
  
  return result;

};

and below is my modal function

static getApisDetail(operatorId) {
    return db.query(
      `select id, api_name, api_type,(select priority from api_switching where api_switching.api_id=api_master.id and operator_id=${operatorId}) as priority,(select isActive from api_switching where  api_switching.api_id=api_master.id and operator_id=${operatorId}) as isActive from api_master where api_type='Recharge' order by api_name asc`
    );
  }
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
  • OK but what is the problem? Where do you get the unexpected result? Did you forget to `await` the `getPriorityList` function maybe? (Note that `async: true` must be set in the EJS configuration for this to be supported.) – CherryDT May 30 '22 at 16:23
  • Does this answer your question? [How to access the value of a promise?](https://stackoverflow.com/questions/29516390/how-to-access-the-value-of-a-promise) – VLAZ May 30 '22 at 16:29
  • Actually i am new to nodejs, so do not know how to configure EJS with async:true, where to put async:true exactly? – Kuldeep Kumar May 30 '22 at 16:33
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community May 31 '22 at 01:40

0 Answers0