Clean up and fixes

This commit is contained in:
2026-02-08 02:32:50 +00:00
parent eb1bf9020e
commit da096af0fa
36 changed files with 2119 additions and 1751 deletions

View File

@@ -58,10 +58,15 @@ export class SyncServer extends EventEmitter<SyncServerEventMap> {
* @param identifier - The invitation identifier.
* @returns The invitation.
*/
async getInvitation(identifier: string): Promise<XOInvitation> {
async getInvitation(identifier: string): Promise<XOInvitation | undefined> {
// Send a GET request to the sync server
const response = await fetch(`${this.baseUrl}/invitations/${identifier}`);
const invitation = await response.json() as XOInvitation;
const response = await fetch(`${this.baseUrl}/invitations?invitationIdentifier=${identifier}`);
if(!response.ok) {
throw new Error(`Failed to get invitation: ${response.statusText}`);
}
const invitation = await response.json() as XOInvitation | undefined;
return invitation;
}
@@ -75,6 +80,9 @@ export class SyncServer extends EventEmitter<SyncServerEventMap> {
const response = await fetch(`${this.baseUrl}/invitations`, {
method: 'POST',
body: encodeExtendedJson(invitation),
headers: {
'Content-Type': 'application/json',
},
});
// Throw is there was an issue with the request