I'm trying to do a simple write to the fb database like so:
return app.register( email, password ).then( f => {
return app.login( email, password )
} ).then( f => {
return app.currentUser()
} ).then( user => {
return app.firebase.db().ref( `users/${user.uid}` ).set( {color: 'red'} )
} ).then( f => {
console.log( "This never triggers" )
} )
Where app.register is:
( firebase, email, password ) => firebase.auth().createUserWithEmailAndPassword( email, password )
Where app.login is:
( firebase, email, password ) => firebase.auth().signInWithEmailAndPassword( email, password )
And app.currentUser is:
firebase => {
return new Promise( ( resolve, reject ) => {
firebase.auth( ).onAuthStateChanged( user => {
user ? resolve( user ) : reject( user )
} )
} )
}
App.firebase is an initialised firebase reference.
I am getting no errors, but the .set() never resolves.
I'm very much stuck, any help appreciated.
via Mentor
No comments:
Post a Comment