fix crud handler.

This commit is contained in:
Miroslav Šedivý 2020-11-21 23:57:54 +01:00
parent ce49d975c0
commit 43781cdf52

View File

@ -32,16 +32,16 @@ func New(
}
func (h *MembersHandler) Route(r chi.Router) {
r.With(auth.AdminsOnly).Group(func(r chi.Router) {
r.Get("/", h.membersList)
r.With(auth.AdminsOnly).Group(func(r chi.Router) {
r.Post("/", h.membersCreate)
r.Get("/{memberId}/", h.membersRead)
r.Post("/{memberId}/", h.membersUpdate)
r.Delete("/{memberId}/", h.membersDelete)
r.With(h.ExtractMember).Route("/{memberId}", func(r chi.Router) {
r.Get("/", h.membersRead)
r.Post("/", h.membersUpdate)
r.Delete("/", h.membersDelete)
})
})
}
func SetMember(r *http.Request, session types.Session) *http.Request {