GX4001: no action is registered for a route type
An on: directive invokes a route type and no gx.Action or gx.Form handles that type.
Cause
An on: directive invokes a route type and no gx.Action or gx.Form handles that type.
Example
package cart
import "app/cart/route"
<button on:click={route.Add{}}>Add</button>package route
import "github.com/alternayte/gx"
type Add struct {
gx.Route `POST /cart/add`
}gx check reports:
cart/Button.gx:5:9: GX4001: no action is registered for "Add"Fix
- Declare the action, for example
var Add = gx.Action(func(c *gx.Ctx, in route.Add) error { ... }). - Add the action to the
gx.Collectcall of its slice.