fix json parsing error

This commit is contained in:
2026-04-23 08:54:13 -05:00
parent 6ee7b5ac34
commit dca7ea5707
5 changed files with 9 additions and 8 deletions
+2 -2
View File
@@ -52,8 +52,8 @@ export class TetherClient {
mutation_id: mutation_id
}));
return new Promise((resolve, reject) => {
this.websocketHandler.onMutation = (data) => {
if (data.mutation_id === mutation_id) {
this.websocketHandler.onMutation = (mutation_id: string, data: any) => {
if (mutation_id === mutation_id) {
resolve(data);
}
};
+3 -2
View File
@@ -8,7 +8,7 @@ export class WebSocketHandler {
private maxReconnectAttempts: number = 5;
private reconnectInterval: number = 1000;
private sendQueue: string[] = [];
public onMutation: (data: any) => void = () => {};
public onMutation: (mutation_id: string, data: any) => void = () => {};
startConnection = (url: string) => {
this.url = url;
this.ws = new WebSocket(url);
@@ -30,11 +30,12 @@ export class WebSocketHandler {
location?: string;
data?: unknown;
error?: string;
mutation_id?: string;
};
if (data.type === 'query') {
this.onQuery(data.location, data.data);
} else if (data.type === 'mutation') {
this.onMutation(data.data);
this.onMutation(data.mutation_id || '', data.data);
} else if (data.type === 'error') {
console.error(data.error);
}