Initial commit
This commit is contained in:
45
Backend/dist/Integrations/buildin/http/http.js
vendored
Normal file
45
Backend/dist/Integrations/buildin/http/http.js
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
exports.__esModule = true;
|
||||
var axios = require('axios')["default"];
|
||||
module.exports = function (api) {
|
||||
//Register a action
|
||||
api.registerAction('request', function (actionAPI) {
|
||||
//Handle the action when executed
|
||||
actionAPI.handle(function (properties, status) {
|
||||
axios[properties.method](properties.address)
|
||||
.then(function (response) {
|
||||
status('Request has been delivered.');
|
||||
})["catch"](function (error) {
|
||||
status('Unable to deliver request.', 'error');
|
||||
});
|
||||
});
|
||||
//Handle the interactive editor
|
||||
actionAPI.onOpenEditor(function (editorAPI, properties) {
|
||||
var method = properties.method != undefined ? properties.method : 'get';
|
||||
var address = properties.address != undefined ? properties.address : '';
|
||||
editorAPI.onFieldChanges(function (fields) {
|
||||
var fieldValues = editorAPI.tools.objectifyFieldsValues(fields);
|
||||
editorAPI.saveProperties({ method: fieldValues.method, address: fieldValues.address });
|
||||
});
|
||||
editorAPI.setFields([
|
||||
{
|
||||
id: 'method',
|
||||
name: 'Method',
|
||||
type: 'select',
|
||||
value: method,
|
||||
values: [
|
||||
{ id: 'get', text: 'GET' },
|
||||
{ id: 'post', text: 'POST' },
|
||||
{ id: 'put', text: 'PUT' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'address',
|
||||
name: 'Address',
|
||||
type: 'text',
|
||||
value: address
|
||||
}
|
||||
]);
|
||||
});
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=http.js.map
|
||||
Reference in New Issue
Block a user