Forked from deltaepsilon/how-to-firebase-8-client-side.js
Created
June 26, 2018 12:51
-
-
Save byteshiva/a545700840a5364f1f32c5bf9bd7580e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Client-side code, in my case a web browser | |
firebase.auth().onAuthStateChanged(function (user) { | |
this.user = user; // Set my local copy of the 'user' object | |
if (user) { | |
this.displayName = user.displayName; | |
this.photoURL = user.photoURL; | |
var userRef = firebase.database().ref('queues/login').child(user.uid); | |
userRef.remove() | |
.then(function () { | |
return userRef.set({ | |
email: user.email, | |
emailVerified: user.emailVerified, | |
photoURL: user.photoURL, | |
displayName: user.displayName, | |
timestamp: new Date().toString() | |
}); | |
}); | |
} | |
}.bind(this)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment