mirror of
https://github.com/kaaninchen/Laterna.git
synced 2026-09-17 19:12:48 +00:00
feat: improve responses
This commit is contained in:
@@ -11,9 +11,9 @@ func WithAdminAuth(handlerFunc http.HandlerFunc) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
token := r.Header.Get("Authorization")
|
||||
if !db.IsAdmin(token) {
|
||||
utils.HTTPResponseHandler(w, r, http.StatusUnauthorized, "Invalid token")
|
||||
return
|
||||
utils.ErrorResponse(w, http.StatusUnauthorized, "Invalid token")
|
||||
return
|
||||
}
|
||||
handlerFunc(w, r)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user