diff --git a/src/views/AddCommentForm.vue b/src/views/AddCommentForm.vue index 3d2d898..0c72384 100644 --- a/src/views/AddCommentForm.vue +++ b/src/views/AddCommentForm.vue @@ -3,12 +3,15 @@ import { useField, useForm } from "vee-validate"; import { string } from "yup"; import { useCommentStore } from "@/comments"; +import { useUser } from "@/components/user"; const commentStore = useCommentStore(); const props = defineProps<{ projectUid: string; }>(); + +const { user } = useUser(); type FormData = { comment: string; }; @@ -23,8 +26,13 @@ const { handleSubmit } = useForm({ const onSubmit = handleSubmit( // Success (values: FormData) => { + if (!user.value) return; // handle form submission here - commentStore.addCommentToProject(values.comment, props.projectUid); + commentStore.addCommentToProject( + values.comment, + props.projectUid, + user.value.uid, + ); }, // Failure (errors) => { diff --git a/src/views/Comments.vue b/src/views/Comments.vue index 9c6b175..3eacea4 100644 --- a/src/views/Comments.vue +++ b/src/views/Comments.vue @@ -32,30 +32,32 @@ const activity = computed(() =>
- +
- {{ - comment.person.name - }} + + + someone + commented
{{ new Date(comment.timestamp).toLocaleString() }}

- {{ comment.comment }} + {{ comment.textContent }}