Files
Nexior/src/assets/templates/javascript.tpl
T
2023-03-02 23:04:23 +08:00

18 lines
382 B
Smarty

const options = {
method: '{{{method}}}',
headers: {
{{#headers}}
'{{{key}}}': {{{value}}}{{^last}},{{/last}}
{{/headers}}
},
body: JSON.stringify({
{{#body}}
'{{{key}}}': {{{value}}}{{^last}},{{/last}}
{{/body}}
})
};
fetch('{{{url}}}', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));