Skip to content

Commit

Permalink
remove form for unlogged user
Browse files Browse the repository at this point in the history
  • Loading branch information
yannicklescure committed Apr 20, 2022
1 parent 9a3de50 commit ce31ac1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion client/src/components/Comments/Comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ import Head from "./Head";
import Form from "./Form";
import Content from "./Content";
import { CommentContext } from "../../contexts/CommentContext";
import { UserContext } from "../../contexts/UserContext";

const Comments = ({ show, handleShowComments, articleId }) => {
const [display, setDisplay] = useState(false);
const [loading, setLoading] = useState(true);
// const [comments, setComments] = useState([]);

const {
state: { user },
} = useContext(UserContext);

const {
state: {
comments
Expand Down Expand Up @@ -60,7 +65,9 @@ const Comments = ({ show, handleShowComments, articleId }) => {
handleShowComments={handleShowComments}
count={comments.length}
/>
<Form articleId={articleId} />
{
user._id && <Form articleId={articleId} />
}
<Content
loading={loading}
articleId={articleId}
Expand Down

0 comments on commit ce31ac1

Please sign in to comment.