Move string to constant

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-02-20 00:27:23 +01:00
parent a7337cf9f1
commit a2484972fe
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

3
api.go
View file

@ -18,6 +18,7 @@ import (
)
const (
msgTypeAlert string = "alert"
msgTypeBits string = "bits"
msgTypeHost string = "host"
msgTypeRaid string = "raid"
@ -122,7 +123,7 @@ func handleCustomAlert(w http.ResponseWriter, r *http.Request) {
return
}
if err := subscriptions.SendAllSockets("alert", alert); err != nil {
if err := subscriptions.SendAllSockets(msgTypeAlert, alert); err != nil {
http.Error(w, errors.Wrap(err, "send to sockets").Error(), http.StatusInternalServerError)
return
}