async onRegister(formRegister) {
this.nbotoncito = false;
this.spinner.show();
if (this.ejercicio.idArea == "2") {
console.log("ejercicios de fisica");
await this.getTotalFisica();
} else {
console.log("cualquier cosa ajena a fisica");
await this.getEjercicios_SubArea();
}
}
async getTotalFisica() {
await this.ejercicioService.getEjercicioTotalFisica().subscribe(
res => {
this.ejercicioTotal = res;
console.log("Respuesta del total de los ejercicios por FISICA: " + res);
},
err => console.log(err),
);
}
Before performing other actions in my onRegister I must have that array of exercises Total Loaded that method of getTotalPhysics comes from a backend hosted in heroku the function is as follows:
getEjercicioTotalFisica(): Observable<EjercicioInterface[]> {
console.log("Solcitando los ejercicos de fisica");
return this.http.get<EjercicioInterface[]>(`${this.BASE_URL}/exercise/fisica`);
}
I must have the compulsory array of exercises Total and necessary before carrying out any type of action in onRegister, and first the subscribe within onRegister is performed before that of getTotalExercises.
I don't receive errors, I'm just looking to fill that array before any action