2023-08-16 06:52:41 -07:00
|
|
|
import type { IExecuteFunctions, ILoadOptionsFunctions, IDataObject } from 'n8n-workflow';
|
2023-01-27 03:22:44 -08:00
|
|
|
import type { IForm } from './FormInterface';
|
2020-04-04 07:04:25 -07:00
|
|
|
import { cockpitApiRequest } from './GenericFunctions';
|
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
export async function submitForm(
|
2023-08-16 06:52:41 -07:00
|
|
|
this: IExecuteFunctions | ILoadOptionsFunctions,
|
2022-08-01 13:47:55 -07:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2024-02-14 07:29:09 -08:00
|
|
|
return await cockpitApiRequest.call(this, 'POST', `/forms/submit/${resourceName}`, body);
|
2020-04-04 07:04:25 -07:00
|
|
|
}
|