Adds Messaging streaming

This commit is contained in:
Jonathan Bourdon
2024-07-19 00:45:00 -04:00
parent 89ac0f8bc4
commit 8afa037fbe
8 changed files with 185 additions and 52 deletions

View File

@@ -2,7 +2,12 @@
<div class="shadow-lg rounded-lg">
<div class="text-lg font-bold">{{ props.content.title }}</div>
<div class="text-lg font-bold">
{{ props.content.title }}
<span class="text-md-caption">
{{ time_ago(props.content.createdAt) }}
</span>
</div>
<div class="h-48 object-cover bg-purple rounded-md">
@@ -39,11 +44,11 @@
<div class="border-b p-6">
<h2 class="font-sans font-semibold">Commentaires</h2>
<MessageList :content-id="props.content.id">
<MessageList :subject-id="props.content.id">
</MessageList>
</div>
<div class="border-b-2 p-6">
<PostMessage :content-id="props.content.id">
<PostMessage :subject-id="props.content.id">
</PostMessage>
</div>
</div>
@@ -57,6 +62,7 @@
import {defineProps, computed} from 'vue';
import MessageList from "@/views/messages/MessageList.vue";
import PostMessage from "@/views/messages/PostMessage.vue";
import {time_ago} from "@/internal_time_ago.js";
const isHttpUrl = computed(() => props.content?.uri?.startsWith('http'))

View File

@@ -37,13 +37,13 @@ const props = defineProps({
const client = useClient()
const contents = ref([])
const max_items = 10
const page_size = 10
const errorMessage = ref()
let last_id = null
async function load({done}) {
try {
let uri = `/api/contents/user/${props.creatorId}?max_items=${max_items}`
let uri = `/api/contents/user/${props.creatorId}?page_size=${page_size}`
if (last_id !== null) uri = uri + `&last_id=${last_id}`
console.log(`Fetching content at: ${uri}`)
@@ -59,7 +59,7 @@ async function load({done}) {
last_id = last_content.id
}
if (contentCount < max_items)
if (contentCount < page_size)
done('empty')
else
done('ok')