2023-03-09 09:13:15 -08:00
|
|
|
import type {
|
|
|
|
IExecuteFunctions,
|
|
|
|
IExecuteSingleFunctions,
|
|
|
|
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(
|
|
|
|
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);
|
|
|
|
}
|