bare repo
This commit is contained in:
parent
d73f9bc01e
commit
3d356225cd
31 changed files with 134 additions and 3005 deletions
|
|
@ -1,27 +0,0 @@
|
|||
import { computed } from 'vue'
|
||||
import { useMessageStore } from '@/stores/messages'
|
||||
import { useNostrStore } from '@/stores/nostr'
|
||||
|
||||
export function useChat(pubkey: string) {
|
||||
const messageStore = useMessageStore()
|
||||
const nostrStore = useNostrStore()
|
||||
|
||||
const messages = computed(() =>
|
||||
messageStore.messages.get(pubkey) || []
|
||||
)
|
||||
|
||||
const sendMessage = async (content: string) => {
|
||||
if (!content.trim()) return
|
||||
await nostrStore.sendMessage(pubkey, content)
|
||||
}
|
||||
|
||||
const loadHistory = async () => {
|
||||
await nostrStore.subscribeToMessages()
|
||||
}
|
||||
|
||||
return {
|
||||
messages,
|
||||
sendMessage,
|
||||
loadHistory
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue