Skip to content
Snippets Groups Projects
Commit d4ca22fe authored by Planoetscher Daniel (Student Com20)'s avatar Planoetscher Daniel (Student Com20)
Browse files

bug fixes

parent ce92bb5f
No related branches found
No related tags found
No related merge requests found
...@@ -11,13 +11,14 @@ interface Props { ...@@ -11,13 +11,14 @@ interface Props {
} }
export default function CommentList({ comments, taskId }: Props) { export default function CommentList({ comments, taskId }: Props) {
const [user, setUser] = useState<User>(); const [user, setUser] = useState<User>();
const [comment, setComment] = useState<string>(''); const [comment, setComment] = useState<string>('');
const [allComments, setComments] = useState<CommentProps[]>(comments); const [allComments, setComments] = useState<CommentProps[]>([]);
useEffect(() => { useEffect(() => {
getCurrentUser().then((user) => setUser(user)); getCurrentUser().then((user) => setUser(user));
}, []); setComments(comments);
}, [comments]);
const handleSubmit = useCallback((e: FormEvent) => { const handleSubmit = useCallback((e: FormEvent) => {
e.preventDefault(); e.preventDefault();
......
...@@ -13,7 +13,7 @@ export default function TaskComments({ taskId }: Props) { ...@@ -13,7 +13,7 @@ export default function TaskComments({ taskId }: Props) {
const [comments, setComments] = useState<CommentProps[]>(); const [comments, setComments] = useState<CommentProps[]>();
useEffect(() => { useEffect(() => {
getTaskComments(taskId).then((comments) => { getTaskComments(taskId).then((comments) => {
setComments(comments.map((comment) => { return { comment } })); setComments(comments.map((comment) => ({ comment })));
}) })
}, [taskId]) }, [taskId])
return ( return (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment