Please sync invitatinos

This commit is contained in:
2026-02-23 06:13:12 +00:00
parent 2c547f766a
commit 38a0ac436b
3 changed files with 7 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
import type { XOInvitation } from "@xo-cash/types";
import { EventEmitter } from "./event-emitter.js";
import { SSESession, type SSEvent } from "./sse-client.js";
import { decodeExtendedJsonObject, encodeExtendedJson } from "./ext-json.js";
import { decodeExtendedJson, decodeExtendedJsonObject, encodeExtendedJson, encodeExtendedJsonObject } from "./ext-json.js";
export type SyncServerEventMap = {
'connected': void;
@@ -66,7 +66,7 @@ export class SyncServer extends EventEmitter<SyncServerEventMap> {
throw new Error(`Failed to get invitation: ${response.statusText}`);
}
const invitation = decodeExtendedJsonObject(await response.text()) as XOInvitation | undefined;
const invitation = decodeExtendedJson(await response.text()) as XOInvitation | undefined;
return invitation;
}
@@ -92,7 +92,7 @@ export class SyncServer extends EventEmitter<SyncServerEventMap> {
// Read the returned JSON
// TODO: This should use zod to verify the response
const data = decodeExtendedJsonObject(await response.text()) as XOInvitation;
const data = decodeExtendedJson(await response.text()) as XOInvitation;
return data;
}