basic working
This commit is contained in:
+4
-4
@@ -173,10 +173,10 @@ const api = {
|
||||
return this.request(`/api/messages?limit=${limit}`);
|
||||
},
|
||||
|
||||
async sendMessage(text, channel = 0) {
|
||||
async sendMessage(from, text) {
|
||||
return this.request('/api/messages/send', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ text, channel })
|
||||
body: JSON.stringify({ text, from })
|
||||
});
|
||||
},
|
||||
|
||||
@@ -546,10 +546,10 @@ document.getElementById('send-message-form')?.addEventListener('submit', async (
|
||||
e.preventDefault();
|
||||
|
||||
const text = document.getElementById('message-text').value;
|
||||
const channel = parseInt(document.getElementById('message-channel').value);
|
||||
const from = parseInt(document.getElementById('message-from').value);
|
||||
|
||||
try {
|
||||
await api.sendMessage(text, channel);
|
||||
await api.sendMessage(text, from);
|
||||
document.getElementById('message-text').value = '';
|
||||
|
||||
// Reload messages after a short delay
|
||||
|
||||
Reference in New Issue
Block a user