diff options
Diffstat (limited to 'roomserver/inthttp/server.go')
-rw-r--r-- | roomserver/inthttp/server.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/roomserver/inthttp/server.go b/roomserver/inthttp/server.go index e3b81daa..1c47e87e 100644 --- a/roomserver/inthttp/server.go +++ b/roomserver/inthttp/server.go @@ -26,6 +26,17 @@ func AddRoutes(r api.RoomserverInternalAPI, internalAPIMux *mux.Router) { return util.JSONResponse{Code: http.StatusOK, JSON: &response} }), ) + internalAPIMux.Handle(RoomserverPerformInvitePath, + httputil.MakeInternalAPI("performInvite", func(req *http.Request) util.JSONResponse { + var request api.PerformInviteRequest + var response api.PerformInviteResponse + if err := json.NewDecoder(req.Body).Decode(&request); err != nil { + return util.MessageResponse(http.StatusBadRequest, err.Error()) + } + r.PerformInvite(req.Context(), &request, &response) + return util.JSONResponse{Code: http.StatusOK, JSON: &response} + }), + ) internalAPIMux.Handle(RoomserverPerformJoinPath, httputil.MakeInternalAPI("performJoin", func(req *http.Request) util.JSONResponse { var request api.PerformJoinRequest @@ -33,9 +44,7 @@ func AddRoutes(r api.RoomserverInternalAPI, internalAPIMux *mux.Router) { if err := json.NewDecoder(req.Body).Decode(&request); err != nil { return util.MessageResponse(http.StatusBadRequest, err.Error()) } - if err := r.PerformJoin(req.Context(), &request, &response); err != nil { - response.ErrMsg = err.Error() - } + r.PerformJoin(req.Context(), &request, &response) return util.JSONResponse{Code: http.StatusOK, JSON: &response} }), ) |