mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): fix for no-uncaught-json-parse warnings
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import EventSource from 'eventsource';
|
||||
import { ITriggerFunctions } from 'n8n-core';
|
||||
import { INodeType, INodeTypeDescription, ITriggerResponse } from 'n8n-workflow';
|
||||
import { INodeType, INodeTypeDescription, ITriggerResponse, jsonParse } from 'n8n-workflow';
|
||||
|
||||
export class SseTrigger implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -37,7 +37,8 @@ export class SseTrigger implements INodeType {
|
||||
const eventSource = new EventSource(url);
|
||||
|
||||
eventSource.onmessage = (event) => {
|
||||
const eventData = JSON.parse(event.data);
|
||||
// tslint:disable-next-line:no-any
|
||||
const eventData = jsonParse<any>(event.data, { errorMessage: 'Invalid JSON for event data' });
|
||||
this.emit([this.helpers.returnJsonArray([eventData])]);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user