Is there a more practical way to nest these observables with RX/JS. Here is a snippet, where I am storing an image first, then returning the download URL and placing it in the real time database.
return new Observable(observer => {
firebase.storage().ref().child('users/' + this.userService.getUserID() + '/messages/').put(image).then((data) => {
updates['photoURL'] = data.downloadURL;
firebase.database().ref().update(updates).then(() => {
observer.next();
observer.complete();
}).catch((error) => {
observer.error(error);
})
}, (error) => {
observer.error(error);
})
});