Skip to content

Commit

Permalink
fix can't get displayName from userAuth
Browse files Browse the repository at this point in the history
  • Loading branch information
TrumanH committed Jan 11, 2023
1 parent e0e2ecb commit d95ccdd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ const App = ()=> {
useEffect(() => {
const unsubscribe = onAuthStateChangeListener((user)=>{
const createUser = async (user) => {
if (!user) {return;}
// console.log(user); // here can't get displayName from userAuth
const userSnapshot = await createUserDocumentFromAuth(user);
return userSnapshot;
const userDoc = userSnapshot.data()
dispatch(setUser(userDoc));
};
if (user) {
const userSnapshot = createUser(user);
console.log(userSnapshot);
dispatch(setUser(user)); // TODO: test and use userSnapshot!
}

createUser(user);
});

return unsubscribe;
Expand Down

0 comments on commit d95ccdd

Please sign in to comment.