feat: Enhance debugging and authentication in Nostr chat
- Add detailed console logging in ChatComponent to track message sending attempts, selected peers, and authentication status. - Integrate authentication checks in useNostrChat, ensuring users have valid Nostr keypairs before sending messages. - Implement logic to generate and store new Nostr keys if none are found, improving user experience and key management.
This commit is contained in:
parent
59e0496ad9
commit
8e94216c02
2 changed files with 118 additions and 6 deletions
|
|
@ -537,6 +537,19 @@ const sendMessage = async () => {
|
|||
if (!selectedPeer.value || !messageInput.value.trim()) return
|
||||
|
||||
try {
|
||||
// Add debugging information
|
||||
console.log('🔍 ChatComponent: Attempting to send message...')
|
||||
console.log('🔍 ChatComponent: Selected peer:', selectedPeer.value)
|
||||
console.log('🔍 ChatComponent: Message content:', messageInput.value)
|
||||
|
||||
// Check authentication status
|
||||
const keyStatus = nostrChat.getNostrKeyStatus()
|
||||
console.log('🔍 ChatComponent: Nostr key status:', keyStatus)
|
||||
|
||||
// Check if user is logged in
|
||||
console.log('🔍 ChatComponent: Is logged in:', nostrChat.isLoggedIn.value)
|
||||
console.log('🔍 ChatComponent: Current user:', nostrChat.currentUser.value)
|
||||
|
||||
await sendNostrMessage(selectedPeer.value.pubkey, messageInput.value)
|
||||
messageInput.value = ''
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue