From 6651d1be1333e3ed359e6b323a48a0b6caf00d21 Mon Sep 17 00:00:00 2001 From: Ruidy Nemausat Date: Tue, 2 Jun 2020 14:08:27 +0200 Subject: [PATCH] fix: use current user info when writing a comment --- src/pages/Post.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pages/Post.tsx b/src/pages/Post.tsx index 58ec6e4..5d138ca 100644 --- a/src/pages/Post.tsx +++ b/src/pages/Post.tsx @@ -21,10 +21,12 @@ interface IProps extends WithFirestoreProps { /** * Display a Post and the related comments. Shows a form to add a comment. */ -const PostPage: FC = ({post, firestore}) => { +const PostPage: FC = ({post, firestore, firebase}) => { + const name = firebase.auth().currentUser?.displayName; + const avatarUrl = firebase.auth().currentUser?.photoURL; const newComment: Comment = { - name: post.name ?? 'error', - avatarUrl: post.avatarUrl ?? 'error', + name: name ?? 'error', + avatarUrl: avatarUrl ?? 'error', text: '', };