n8n-nodes-base
Version:
Base nodes of n8n
29 lines • 1.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.create = create;
const transport_1 = require("../../../transport");
async function create(index) {
const username = this.getNodeParameter('username', index);
const authService = this.getNodeParameter('authService', index);
const additionalFields = this.getNodeParameter('additionalFields', index);
const qs = {};
const requestMethod = 'POST';
const endpoint = 'users';
const body = {};
body.auth_service = authService;
body.username = username;
Object.assign(body, additionalFields);
if (body.notificationUi) {
body.notify_props = body.notificationUi.notificationValues;
}
if (authService === 'email') {
body.email = this.getNodeParameter('email', index);
body.password = this.getNodeParameter('password', index);
}
else {
body.auth_data = this.getNodeParameter('authData', index);
}
const responseData = await transport_1.apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData);
}
//# sourceMappingURL=execute.js.map