mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 08:02:26 +00:00
re-allow multiple statements but must use a return
This commit is contained in:
@@ -216,13 +216,18 @@ async function resource(path) {{
|
||||
(String::new(), String::new())
|
||||
};
|
||||
|
||||
let f = if expr.contains("return ") {
|
||||
expr.to_string()
|
||||
} else {
|
||||
format!("return {expr}")
|
||||
};
|
||||
let code = format!(
|
||||
r#"
|
||||
{api_code}
|
||||
{}
|
||||
{by_id_code}
|
||||
(async () => {{
|
||||
return {expr};
|
||||
{f};
|
||||
}})()
|
||||
"#,
|
||||
env.into_iter()
|
||||
|
||||
@@ -39,5 +39,6 @@
|
||||
<b>resource(path)</b>: the function returning the resource at a given path as an object
|
||||
</li>
|
||||
</ul>
|
||||
If using multiple statements, the last statement shall finish with a return. e.g: `return x`
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user