mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
API update: control give memberId.
This commit is contained in:
parent
7c8f0e66cb
commit
a6dccc753b
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user