Hi, I am developing a login service and I want to wait for an observable get user data. But when I use .toPromise, execution freezes. If I set a timeout, a timeout error will be generated.
This is my code
let vaCollection = this.firestore.collection<TUsuario>('usuario');
try {
let vaUsuarios = await vaCollection.valueChanges().pipe(timeout(1500)).toPromise();
//never get here
for (let vaUs of vaUsuarios) {
console.log(vaUs);
}
} catch (error) {
console.log('Erro na busca: '+ error);
}
This is my dependencies
"dependencies": {
"@angular/common": "~8.1.2",
"@angular/compiler": "~8.1.2",
"@angular/core": "~8.1.2",
"@angular/fire": "^5.2.1",
"@angular/forms": "~8.1.2",
"@angular/platform-browser": "~8.1.2",
"@angular/platform-browser-dynamic": "~8.1.2",
"@angular/router": "~8.1.2",
"@ionic-native/core": "^5.0.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^4.7.1",
"br-mask": "0.0.8",
"cordova-android": "^8.1.0",
"core-js": "^2.5.4",
"date-fns": "^2.4.1",
"firebase": "^6.6.2",
"rxjs": "~6.5.1",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
What’s the problem?