Hi all.
I’m having a bit of an issue with an Observable seen below:
private ConfirmAuthenticationAvailable()
{
if (this.registerCredentials.logID === null || this.registerCredentials.password === null) {
return Observable.throw("Please insert credentials");
} else {
console.log("got to here")
return Observable.create(observer => {
console.log("got to can't get to here")
this.sqlite.create({
name: 'ionicdb.db',
location: 'default'
}).then((db: SQLiteObject) => {
db.executeSql('SELECT * FROM users;', {})
.then((resUsersLoaded) => {
this.userSelection = resUsersLoaded;
for (let i = 0; i < resUsersLoaded.rows.length; i++) {
let item = resUsersLoaded.rows.item(i);
console.log(item);
}
}).catch(e => console.log(e));
}
).catch(e => console.log(e));
// this.currentUser = new User('ename', 'ename@email.ca');
observer.next(access);
observer.complete();
});
}
}
In debugging the code (and watching for the console outputs) the code appears to return immediatly at:
return Observable.create(observer => {
I’m I structuring this in an inappropriate way that would cause this to happen? I’m coming up short looking at the documentation and the source I’m working from.
(sorry for the ugly code otherwise, it’s part of a WIP…)