Initial creation of endpoint to send messages to public reporters

This commit is contained in:
Eli Ribble 2026-03-15 22:38:36 +00:00
parent 9707e8793b
commit cc95c38ab5
No known key found for this signature in database
12 changed files with 240 additions and 20 deletions

View file

@ -216,15 +216,26 @@
}
},
sendMessage() {
async sendMessage() {
if (!this.messageText.trim()) return;
// TODO: Implement API call to send message
console.log(
"Sending message to:",
this.selectedCommunication.public_report.reporter.has_email,
);
console.log("Message:", this.messageText);
console.log("Sending message reporter:", this.messageText);
const payload = {
message: this.messageText,
reportID: this.selectedCommunication.id,
};
const response = await fetch(`${this.apiBase}/publicreport/message`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
// Add to activity log
if (!this.selectedCommunication.history) {