API update: control give memberId.

This commit is contained in:
Miroslav Šedivý 2020-12-26 23:53:04 +01:00
parent 7c8f0e66cb
commit a6dccc753b

View File

@ -3,6 +3,8 @@ package room
import ( import (
"net/http" "net/http"
"github.com/go-chi/chi"
"demodesk/neko/internal/types/event" "demodesk/neko/internal/types/event"
"demodesk/neko/internal/types/message" "demodesk/neko/internal/types/message"
"demodesk/neko/internal/utils" "demodesk/neko/internal/utils"
@ -102,12 +104,9 @@ func (h *RoomHandler) controlTake(w http.ResponseWriter, r *http.Request) {
} }
func (h *RoomHandler) controlGive(w http.ResponseWriter, r *http.Request) { func (h *RoomHandler) controlGive(w http.ResponseWriter, r *http.Request) {
data := &ControlTargetPayload{} memberId := chi.URLParam(r, "memberId")
if !utils.HttpJsonRequest(w, r, data) {
return
}
target, ok := h.sessions.Get(data.ID) target, ok := h.sessions.Get(memberId)
if !ok { if !ok {
utils.HttpBadRequest(w, "Target member was not found.") utils.HttpBadRequest(w, "Target member was not found.")
return return