mirror of
https://github.com/hay-kot/mealie.git
synced 2025-07-12 16:14:02 -07:00
update development scripts
This commit is contained in:
parent
791211f787
commit
0e8e2971d0
7 changed files with 171 additions and 70 deletions
17
dev/scripts/templates/js_api_interface.j2
Normal file
17
dev/scripts/templates/js_api_interface.j2
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { requests } from "../requests";
|
||||
|
||||
const prefix = '{{paths.prefix}}'
|
||||
|
||||
const routes = { {% for path in paths.static_paths %}
|
||||
{{ path.router_camel }}: `${prefix}{{ path.route }}`,{% endfor %}
|
||||
{% for path in paths.function_paths %}
|
||||
{{path.router_camel}}: ({{path.var|join(", ")}}) => `${prefix}{{ path.js_route }}`,{% endfor %}
|
||||
}
|
||||
|
||||
export const {{paths.export_name}}API = { {% for path in paths.all_paths %} {% for verb in path.http_verbs %}
|
||||
{% if verb.js_docs %}/** {{ verb.js_docs }}
|
||||
*/ {% endif %}
|
||||
async {{ verb.summary_camel }}({{ verb.function_args() }}) {
|
||||
return await requests.{{ verb.request_type.value }}(routes.{{ path.route_object.router_camel }}{% if path.route_object.is_function %}({{verb.path_params()}}){% endif %}, {{ verb.query_params() }} {{ verb.payload() }})
|
||||
}, {% endfor %} {% endfor %}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue