{
const box = document.getElementById('chat-scroll-box');
if (box) box.scrollTop = box.scrollHeight;
});
},
init() {
this.scrollToBottom();
},
async sendMessage() {
if (!this.newMessageText.trim() || this.isSending) return;
this.isSending = true;
const text = this.newMessageText;
this.newMessageText = '';
try {
const res = await fetch('/resume-hub/public/messaging/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': '5771f973fc8b8c346b767765a674993dfe2bdda2d4e0b81405ca356183626341'
},
body: JSON.stringify({
conversation_id: this.activeConvId,
body: text
})
});
const data = await res.json();
if (data.success) {
this.messages.push(data.message);
this.scrollToBottom();
}
} catch (e) {
console.error(e);
} finally {
this.isSending = false;
}
}
}"
>
Messaging
🔍