diff --git a/sui/api/render.go b/sui/api/render.go index 8b3380c9..9a00d767 100644 --- a/sui/api/render.go +++ b/sui/api/render.go @@ -126,7 +126,13 @@ func TemplateRender(process *process.Process) interface{} { exception.New(err.Error(), 500).Throw() } - root, err := sui.PublicRootWithSid(process.Sid) + opt := process.ArgsMap(4, map[string]interface{}{}) + params, ok := opt["params"].(map[string]interface{}) + if !ok { + params = map[string]interface{}{} + } + + root, err := sui.PublicRoot(params) if err != nil { exception.New(err.Error(), 500).Throw() } @@ -145,7 +151,6 @@ func TemplateRender(process *process.Process) interface{} { } data := process.ArgsMap(3) - opt := process.ArgsMap(4, map[string]interface{}{}) option := core.ParserOption{ Theme: opt["theme"], Locale: opt["locale"], diff --git a/sui/core/interfaces.go b/sui/core/interfaces.go index a73b511b..59eb5ddd 100644 --- a/sui/core/interfaces.go +++ b/sui/core/interfaces.go @@ -29,6 +29,7 @@ type SUI interface { PublicRootMatcher() *Matcher GetPublic() *Public PublicRootWithSid(sid string) (string, error) + PublicRoot(data map[string]any) (string, error) } // ITemplate is the interface for the ITemplate diff --git a/sui/core/script.go b/sui/core/script.go index 51a89c9b..6f3eb274 100644 --- a/sui/core/script.go +++ b/sui/core/script.go @@ -98,6 +98,8 @@ func (script *Script) Call(r *Request, method string, args ...any) (interface{}, } defer ctx.Close() + // Set the sid + ctx.Sid = r.Sid res, err := ctx.Call(method, args...) if err != nil { return nil, err @@ -118,6 +120,8 @@ func (script *Script) BeforeRender(r *Request, props map[string]interface{}) (Da return nil, nil } + // Set the sid + ctx.Sid = r.Sid res, err := ctx.Call("BeforeRender", r, props) if err != nil { return nil, err