fix: URL-encode alert IDs in API calls to fix acknowledgement

Alert IDs containing special characters (colons and slashes) were not being
URL-encoded before use in API endpoints, causing the backend to fail to find
and acknowledge alerts. This fixes issue #482.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
rcourtman
2025-10-01 10:38:22 +00:00
parent 4160d2e68b
commit b81b7eb641
+3 -3
View File
@@ -34,14 +34,14 @@ export class AlertsAPI {
// Removed unused config methods - not implemented in backend
static async acknowledge(alertId: string, user?: string): Promise<{ success: boolean }> {
return apiFetchJSON(`${this.baseUrl}/${alertId}/acknowledge`, {
return apiFetchJSON(`${this.baseUrl}/${encodeURIComponent(alertId)}/acknowledge`, {
method: 'POST',
body: JSON.stringify({ user }),
});
}
static async unacknowledge(alertId: string): Promise<{ success: boolean }> {
return apiFetchJSON(`${this.baseUrl}/${alertId}/unacknowledge`, {
return apiFetchJSON(`${this.baseUrl}/${encodeURIComponent(alertId)}/unacknowledge`, {
method: 'POST',
});
}
@@ -59,7 +59,7 @@ export class AlertsAPI {
}
static async clearAlert(alertId: string): Promise<{ success: boolean }> {
return apiFetchJSON(`${this.baseUrl}/${alertId}/clear`, {
return apiFetchJSON(`${this.baseUrl}/${encodeURIComponent(alertId)}/clear`, {
method: 'POST',
});
}