I am trying to make the existing code to async/non-blocking code. Can anyone help me with this? This is in route.js
async model(params) {
let userCertificate = await Certificate.findByPublicId(this, params.certificate_public_id, { competencies: true }),
product,
competency,
user = await User.find(this, userCertificate.user_id);
if (userCertificate.granted_by_product_id) {
product = await Product.find(this, userCertificate.granted_by_product_id);
} else if (userCertificate.granted_by_competency_id) {
competency = await Competency.find(this, userCertificate.granted_by_competency_id);
}
await userCertificate.fetchFileData(this);
return { userCertificate, product, competency, user};
}
Aucun commentaire:
Enregistrer un commentaire