Skip to content

Commit

Permalink
fix: user profile creation
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelmord committed Apr 19, 2020
1 parent 4616512 commit 0bc77ef
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import { firestore } from '../initFirebase';
export const userCreateHandler = functions
.region('europe-west1')
.auth.user()
.onCreate(async (user) => {
.onCreate(async (userRecord) => {
try {
await firestore.collection('users').add({
email: user.email,
emailVerified: user.emailVerified,
providerData: user.providerData,
const { email, displayName, photoURL, uid } = userRecord;
return await firestore.collection('users').add({
uid,
email,
displayName,
photoURL,
});
} catch (e) {
console.log(e);
console.error(e);
}
});

0 comments on commit 0bc77ef

Please sign in to comment.