mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
⚡ Improvements to Webflow-Node
This commit is contained in:
parent
0c144e4b0f
commit
346ae8efc9
|
@ -28,7 +28,7 @@ export class WebflowOAuth2Api implements ICredentialType {
|
|||
{
|
||||
displayName: 'Scope',
|
||||
name: 'scope',
|
||||
type: 'string' as NodePropertyTypes,
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue