Fix the appearance of comments

This commit is contained in:
Jonathan Bourdon
2024-07-22 00:30:22 -04:00
parent d392730c98
commit e376a0d571
7 changed files with 40 additions and 30 deletions

View File

@@ -5,7 +5,8 @@
<div class="flex flex-row">
<div class="mx-2 content-center">
<img src="/images/usersmedia/anonyme/profilepictures/profileAnonymeSquare.png"
<img :src="profileUrl"
alt="Profile Image"
class="rounded-full"
width="32px"
@@ -46,11 +47,12 @@ const props = defineProps({
}
});
const emit = defineEmits(['message-posted']);
const emit = defineEmits(['message-posted'])
const client = useClient();
const value = ref("");
const user = useUserStore();
const client = useClient()
const value = ref("")
const user = useUserStore()
const profileUrl = ref(user.getCurrentUser().storedDataUrls.profilePictureUrl ?? '/images/usersmedia/anonyme/profilepictures/profileAnonymeSquare.png')
const publish = async () => {
@@ -62,15 +64,21 @@ const publish = async () => {
"subjectId": props.subjectId,
"message": value.value
})
const currentUser = user.getCurrentUser()
emit('message-posted',
{
"id": messageId,
"subjectId": props.subjectId,
"createdBy": user.getCurrentUser().id,
"createdBy": currentUser.id,
"createdByName": currentUser.alias ?? `${currentUser.firstName} ${currentUser.lastName}`,
"createdByPortraitUrl": currentUser.storedDataUrls.profilePictureUrl,
"createdAt": new Date(Date.now()).toISOString(),
"value": value.value,
parentId: null,
})
value.value = ''
} catch (error) {
console.error(`post api/message : ${error}`)
}