add frontend template + GET /users/{userRef} route

This commit is contained in:
Sam 2022-05-04 16:27:16 +02:00
parent 5a75f99720
commit 580449440a
28 changed files with 1393 additions and 12 deletions

View file

@ -4,6 +4,7 @@ import (
"context"
"net/http"
"github.com/go-chi/render"
"gitlab.com/1f320/pronouns/backend/server/auth"
)
@ -34,7 +35,12 @@ func MustAuth(next http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
_, ok := ClaimsFromContext(r.Context())
if !ok {
render.Status(r, errCodeStatuses[ErrForbidden])
render.JSON(w, r, APIError{
Code: ErrForbidden,
Message: errCodeMessages[ErrForbidden],
})
return
}
next.ServeHTTP(w, r)