refactor(core): fix for no-uncaught-json-parse warnings

This commit is contained in:
Michael Kret
2022-10-21 21:52:43 +03:00
committed by GitHub
parent ca9eca9ae9
commit 1d57b10942
36 changed files with 150 additions and 93 deletions

View File

@@ -7,6 +7,7 @@ import {
INodeType,
INodeTypeDescription,
IWebhookResponseData,
jsonParse,
} from 'n8n-workflow';
import { wufooApiRequest } from './GenericFunctions';
@@ -153,7 +154,10 @@ export class WufooTrigger implements INodeType {
return {};
}
const fieldsObject = JSON.parse(req.body.FieldStructure);
// tslint:disable-next-line:no-any
const fieldsObject = jsonParse<any>(req.body.FieldStructure, {
errorMessage: "Invalid JSON in request body field 'FieldStructure'",
});
fieldsObject.Fields.map((field: IField) => {
// TODO
@@ -206,8 +210,12 @@ export class WufooTrigger implements INodeType {
entryId: req.body.EntryId as number,
dateCreated: req.body.DateCreated as Date,
formId: req.body.FormId as string,
formStructure: JSON.parse(req.body.FormStructure),
fieldStructure: JSON.parse(req.body.FieldStructure),
formStructure: jsonParse(req.body.FormStructure, {
errorMessage: "Invalid JSON in request body field 'FormStructure'",
}),
fieldStructure: jsonParse(req.body.FieldStructure, {
errorMessage: "Invalid JSON in request body field 'FieldStructure'",
}),
entries,
};