Así que tengo una función principal que es asíncrona y espera mi otra función.
main = async () => { await this.getResult(); console.log("end2") }así que aquí está la función getResult
getResult() = async () => { const result= await fetch(``, this.requestOptions) console.log("end1"); Promise.all(a.map(async b => { console.log("Transaction", trabnsaction); })) }end2 se imprime primero.
También debe agregar await en Promise.all .
getResult() = async () => { const result= await fetch(``, this.requestOptions) console.log("end1"); await Promise.all(a.map(async b => { console.log("Transaction", trabnsaction); })) }Debe devolver Promise.all , también debe devolver una promesa del método de map .