fix routing

This commit is contained in:
Erik Winter 2024-01-13 18:24:08 +01:00
parent 60e4de9afb
commit 208dedeeb6
1 changed files with 2 additions and 2 deletions

View File

@ -27,14 +27,14 @@ func (reviewAPI *ReviewAPI) ServeHTTP(w http.ResponseWriter, r *http.Request) {
subPath, subTrail := ShiftPath(r.URL.Path) subPath, subTrail := ShiftPath(r.URL.Path)
subSubPath, _ := ShiftPath(subTrail) subSubPath, _ := ShiftPath(subTrail)
switch { switch {
case r.Method == http.MethodGet && subPath != "":
reviewAPI.Get(w, r, subPath)
case r.Method == http.MethodGet && subPath == "": case r.Method == http.MethodGet && subPath == "":
reviewAPI.List(w, r) reviewAPI.List(w, r)
case r.Method == http.MethodGet && subPath == "unrated" && subSubPath == "": case r.Method == http.MethodGet && subPath == "unrated" && subSubPath == "":
reviewAPI.ListUnrated(w, r) reviewAPI.ListUnrated(w, r)
case r.Method == http.MethodGet && subPath == "unrated" && subSubPath == "next": case r.Method == http.MethodGet && subPath == "unrated" && subSubPath == "next":
reviewAPI.NextUnrated(w, r) reviewAPI.NextUnrated(w, r)
case r.Method == http.MethodGet && subPath != "":
reviewAPI.Get(w, r, subPath)
case r.Method == http.MethodPut && subPath != "": case r.Method == http.MethodPut && subPath != "":
reviewAPI.Store(w, r, subPath) reviewAPI.Store(w, r, subPath)
default: default: