GX4009: action method cannot be invoked from the client
An on: directive invokes an action whose HTTP method the browser adapter cannot send.
Cause
An on: directive invokes an action whose HTTP method the browser adapter cannot send.
Example
package cart
import "app/cart/route"
<button on:click={route.Add{}}>Add</button>package cart
import (
"github.com/alternayte/gx"
"app/cart/route"
)
var Add = gx.Action(func(c *gx.Ctx, in route.Add) error { return nil })package route
import "github.com/alternayte/gx"
type Add struct {
gx.Route `OPTIONS /cart/add`
}gx check reports:
cart/Button.gx:5:9: GX4009: method OPTIONS of "Add" cannot be invoked from the clientFix
Use GET, POST, PUT, PATCH or DELETE in the route tag.