mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 05:17:28 -08:00
⚡ small improvements
This commit is contained in:
parent
e411e46ef7
commit
f03936b468
|
@ -13,7 +13,7 @@ export async function gumroadApiRequest(this: IHookFunctions | IExecuteFunctions
|
|||
if (credentials === undefined) {
|
||||
throw new Error('No credentials got returned!');
|
||||
}
|
||||
body = Object.assign({ access_token: credentials.accessToken }, body)
|
||||
body = Object.assign({ access_token: credentials.accessToken }, body);
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
method,
|
||||
|
@ -30,9 +30,9 @@ export async function gumroadApiRequest(this: IHookFunctions | IExecuteFunctions
|
|||
try {
|
||||
return await this.helpers.request!(options);
|
||||
} catch (error) {
|
||||
let errorMessage = error
|
||||
let errorMessage = error;
|
||||
if (!error.success) {
|
||||
errorMessage.message
|
||||
errorMessage.message;
|
||||
}
|
||||
throw new Error('Gumroad Error: ' + errorMessage);
|
||||
}
|
||||
|
|
|
@ -79,9 +79,7 @@ export class GumroadTrigger implements INodeType {
|
|||
description: 'The resource is gonna fire the event',
|
||||
},
|
||||
],
|
||||
|
||||
};
|
||||
|
||||
// @ts-ignore
|
||||
webhookMethods = {
|
||||
default: {
|
||||
|
@ -90,12 +88,12 @@ export class GumroadTrigger implements INodeType {
|
|||
if (webhookData.webhookId === undefined) {
|
||||
return false;
|
||||
}
|
||||
const endpoint = `/resource_subscriptions`;
|
||||
const endpoint = '/resource_subscriptions';
|
||||
const { resource_subscriptions } = await gumroadApiRequest.call(this, 'GET', endpoint);
|
||||
if (Array.isArray(resource_subscriptions)) {
|
||||
for (const resource of resource_subscriptions) {
|
||||
if (resource.id === webhookData.webhookId) {
|
||||
return true
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue