n8n/packages/nodes-base/nodes/Cockpit/FormFunctions.ts

17 lines
531 B
TypeScript
Raw Normal View History

import type { IExecuteFunctions, IExecuteSingleFunctions, ILoadOptionsFunctions } from 'n8n-core';
import type { IDataObject } from 'n8n-workflow';
import type { IForm } from './FormInterface';
2020-04-04 07:04:25 -07:00
import { cockpitApiRequest } from './GenericFunctions';
export async function submitForm(
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
resourceName: string,
form: IDataObject,
) {
2020-04-04 07:04:25 -07:00
const body: IForm = {
2020-10-22 06:46:03 -07:00
form,
2020-04-04 07:04:25 -07:00
};
return cockpitApiRequest.call(this, 'post', `/forms/submit/${resourceName}`, body);
}