mirror of
https://github.com/rjNemo/devbook_ts
synced 2026-06-06 02:36:39 +00:00
fix: use current user info when writing a comment
This commit is contained in:
parent
88efe1a33b
commit
e67047fa46
1 changed files with 5 additions and 3 deletions
|
|
@ -4,9 +4,10 @@ import {useParams, Link} from 'react-router-dom';
|
|||
import Routes from '../constants/routes';
|
||||
// Redux
|
||||
import {compose} from '@reduxjs/toolkit';
|
||||
import {connect} from 'react-redux';
|
||||
import {connect, useSelector} from 'react-redux';
|
||||
import {firestoreConnect, WithFirestoreProps} from 'react-redux-firebase';
|
||||
import {RootState} from '../store';
|
||||
import {selectProfile} from '../store/firebase';
|
||||
import Collections from '../constants/collections';
|
||||
// Typing
|
||||
import Post from '../models/Post';
|
||||
|
|
@ -22,9 +23,10 @@ interface IProps extends WithFirestoreProps {
|
|||
* Display a Post and the related comments. Shows a form to add a comment.
|
||||
*/
|
||||
const PostPage: FC<IProps> = ({post, firestore}) => {
|
||||
const {avatarUrl, displayName} = useSelector(selectProfile);
|
||||
const newComment: Comment = {
|
||||
name: post.name ?? 'error',
|
||||
avatarUrl: post.avatarUrl ?? 'error',
|
||||
name: displayName ?? 'error',
|
||||
avatarUrl: avatarUrl ?? 'error',
|
||||
text: '',
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue