File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
mopidy_api_explorer/static/js Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -58,11 +58,18 @@ Handlebars.registerHelper("apiMethodCurlCall", function(apiMethod) {
5858 window . location . origin + "/mopidy/rpc" ;
5959} ) ;
6060Handlebars . registerHelper ( "apiMethodJsCall" , function ( apiMethod ) {
61- return "mopidy." + snakeToCamel ( apiMethod . methodName . replace ( "core." , "" ) ) +
62- `(${ JSON . stringify ( apiMethod . methodData . params ) } ).then(` +
63- "function(data) {\n" +
64- " console.log(data);\n" +
65- "});" ;
61+ let call = "mopidy." + snakeToCamel ( apiMethod . methodName . replace ( "core." , "" ) ) ;
62+ if ( Object . keys ( apiMethod . methodData . params ) . length > 0 ) {
63+ call += `(${ JSON . stringify ( apiMethod . methodData . params ) } )` ;
64+ } else {
65+ call += "()" ;
66+ }
67+
68+ call += ".then(function(data) {\n" ;
69+ call += " console.log(data);\n" ;
70+ call += "});" ;
71+
72+ return call ;
6673} ) ;
6774
6875function prepareMopidyApiToc ( describeData ) {
You can’t perform that action at this time.
0 commit comments