fix party event

This commit is contained in:
Daniel Bulant 2026-05-04 11:46:17 +02:00
parent 7b8ec190a8
commit 33b35e7735
No known key found for this signature in database
2 changed files with 6 additions and 7 deletions

View file

@ -83,8 +83,7 @@ export type QuizState = {
};
export type PartySocketEvent =
| { type: "snapshot"; party: Party | null; members: PartyMemberWithUser[] }
| { type: "party_status"; party: Party; members: PartyMemberWithUser[] }
| { type: "party_status"; party: Party|null; members: PartyMemberWithUser[] }
| { type: "member_payload"; fromUserId: string; payload: unknown }
| { type: "error"; message: string }
| { type: "pong" };

View file

@ -74,10 +74,10 @@ export const partySocketApp = new Elysia()
if (!membership) {
ws.send(
JSON.stringify({
type: "snapshot",
type: "party_status",
party: null,
members: [],
}),
} as PartySocketEvent),
);
return;
}
@ -89,10 +89,10 @@ export const partySocketApp = new Elysia()
if (snapshot) {
ws.send(
JSON.stringify({
type: "snapshot",
type: "party_status",
party: snapshot.party,
members: snapshot.members,
}),
} as PartySocketEvent),
);
await broadcastQuizState(ws, membership.partyId);
@ -143,7 +143,7 @@ export const partySocketApp = new Elysia()
type: "member_payload",
fromUserId: user.id,
payload: parsed.payload,
}),
} as PartySocketEvent),
);
},
close: async (ws) => {