Skip to content

Commit 17f619f

Browse files
committed
improve API: form.SubmitTo
1 parent cbcf7c0 commit 17f619f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

internal/comp/form.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func (f Form) Submit(callback func(schema.Schema) error) Form {
228228
// SubmitTo submits the form data to the specified struct or map and executes a custom callback
229229
// receiver can be a struct pointer, map, or other types that can be deserialized from JSON
230230
// callback allows further processing of the received data
231-
func (f Form) SubmitTo(receiver any, callback func(any) error) Form {
231+
func (f Form) SubmitTo(receiver any, callback func() error) Form {
232232
return f.Api(servemux.BindRouteTo(f.mux(), receiver, callback))
233233
}
234234

internal/servemux/util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ func BindDataRoute(mux *http.ServeMux, callback func(schema.Schema) error) strin
3232
})
3333
}
3434

35-
func BindRouteTo(mux *http.ServeMux, receiver any, callback func(any) error) string {
35+
func BindRouteTo(mux *http.ServeMux, receiver any, callback func() error) string {
3636
return handleGenericRequest(mux, func(input []byte) error {
3737
if err := json.Unmarshal(input, receiver); err != nil {
3838
return fmt.Errorf("data unmarshal: %w", err)
3939
}
40-
return callback(receiver)
40+
return callback()
4141
})
4242
}
4343

0 commit comments

Comments
 (0)