mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
⚡ Improvements to Webflow-Node
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import { OptionsWithUri } from 'request';
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
@@ -6,7 +9,10 @@ import {
|
||||
ILoadOptionsFunctions,
|
||||
IWebhookFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IDataObject } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function webflowApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IWebhookFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
const authenticationMethod = this.getNodeParameter('authentication', 0);
|
||||
@@ -40,6 +46,9 @@ export async function webflowApiRequest(this: IHookFunctions | IExecuteFunctions
|
||||
return await this.helpers.requestOAuth2!.call(this, 'webflowOAuth2Api', options);
|
||||
}
|
||||
} catch (error) {
|
||||
throw new Error('Webflow Error: ' + error.code + error.msg);
|
||||
if (error.response.body.err) {
|
||||
throw new Error(`Webflow Error: [${error.statusCode}]: ${error.response.body.err}`);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user