Move middlewares to web/middleware (#14480)
Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
0e0424c8ec
commit
5e20fd6dbf
26 changed files with 126 additions and 126 deletions
|
@ -11,7 +11,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/middlewares"
|
||||
"code.gitea.io/gitea/modules/web/middleware"
|
||||
|
||||
"gitea.com/go-chi/binding"
|
||||
"github.com/go-chi/chi"
|
||||
|
@ -120,17 +120,17 @@ func Bind(obj interface{}) http.HandlerFunc {
|
|||
var theObj = reflect.New(tp).Interface() // create a new form obj for every request but not use obj directly
|
||||
binding.Bind(ctx.Req, theObj)
|
||||
SetForm(ctx, theObj)
|
||||
middlewares.AssignForm(theObj, ctx.Data)
|
||||
middleware.AssignForm(theObj, ctx.Data)
|
||||
})
|
||||
}
|
||||
|
||||
// SetForm set the form object
|
||||
func SetForm(data middlewares.DataStore, obj interface{}) {
|
||||
func SetForm(data middleware.DataStore, obj interface{}) {
|
||||
data.GetData()["__form"] = obj
|
||||
}
|
||||
|
||||
// GetForm returns the validate form information
|
||||
func GetForm(data middlewares.DataStore) interface{} {
|
||||
func GetForm(data middleware.DataStore) interface{} {
|
||||
return data.GetData()["__form"]
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue