refactor(core): fix for no-uncaught-json-parse warnings
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
jsonParse,
|
||||
NodeApiError,
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
@@ -171,7 +172,7 @@ export class Discord implements INodeType {
|
||||
|
||||
if (options.allowed_mentions) {
|
||||
//@ts-expect-error
|
||||
body.allowed_mentions = JSON.parse(options.allowed_mentions);
|
||||
body.allowed_mentions = jsonParse(options.allowed_mentions);
|
||||
}
|
||||
|
||||
if (options.avatarUrl) {
|
||||
@@ -188,12 +189,12 @@ export class Discord implements INodeType {
|
||||
|
||||
if (options.payloadJson) {
|
||||
//@ts-expect-error
|
||||
body.payload_json = JSON.parse(options.payloadJson);
|
||||
body.payload_json = jsonParse(options.payloadJson);
|
||||
}
|
||||
|
||||
if (options.attachments) {
|
||||
//@ts-expect-error
|
||||
body.attachments = JSON.parse(options.attachments as DiscordAttachment[]);
|
||||
body.attachments = jsonParse(options.attachments as DiscordAttachment[]);
|
||||
}
|
||||
|
||||
//* Not used props, delete them from the payload as Discord won't need them :^
|
||||
@@ -270,7 +271,7 @@ export class Discord implements INodeType {
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({success: true}),
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
|
||||
Reference in New Issue
Block a user