diff --git a/app/composables/useBunnyChat.ts b/app/composables/useBunnyChat.ts index 74396d36..feec91e9 100644 --- a/app/composables/useBunnyChat.ts +++ b/app/composables/useBunnyChat.ts @@ -113,7 +113,9 @@ async function init(tvUrl: string, tvToken: string) { const items: ChatMessage[] = (message as any).data ?? []; for (const item of items) { - messages.value.push(item); + if (!messages.value.some((m) => m.id === item.id)) { + messages.value.push(item); + } } } })(); @@ -147,6 +149,8 @@ async function send(text: string, url: string) { }); } +export { destroy }; + export function useBunnyChat() { const { public: { tvUrl, tvToken }, @@ -154,5 +158,5 @@ export function useBunnyChat() { onMounted(() => init(tvUrl as string, tvToken as string)); - return { messages, handle, visitorId, isConnected, send, destroy }; + return { messages, handle, visitorId, isConnected, send }; } diff --git a/app/pages/tv/bunny/[video].vue b/app/pages/tv/bunny/[video].vue index fd89bca8..4af356d6 100644 --- a/app/pages/tv/bunny/[video].vue +++ b/app/pages/tv/bunny/[video].vue @@ -1,97 +1,12 @@