I have the following code:
private async getInitialPosition(): Promise<any> {
await this.fetchFloors();
console.log("PAPAPA")
}
private fetchFloors(): Promise<any> {
return new Promise(async () => {
await this.platform.ready().then(async () => {
await cordova.plugins.Situm.fetchFloorsFromBuilding(this.building, res => {
this.floors = res;
console.log("PLANTAS")
console.log(this.floors)
}, () => console.log("ERROR"));
Promise.resolve();
});
Promise.resolve();
})
}
But ‘PAPAPA’ is showing before ‘PLANTAS’
Why is this? What’s wrong with this code?
Thanks!