mirror of
https://github.com/LCE-Hub/LCE-Emerald-Launcher.git
synced 2026-07-19 08:47:19 +00:00
fix: invites not showing up
This commit is contained in:
parent
7edcfd33b0
commit
46078d2b08
|
|
@ -7,7 +7,7 @@ import { TauriService } from "../../services/TauriService";
|
|||
interface LceOnlineViewProps {
|
||||
addFriendTarget?: string | null;
|
||||
onClearAddFriendTarget?: () => void;
|
||||
invites?: Array<{ from: string; sessionid: string }>;
|
||||
invites?: Array<{ inviteid: string; from: { uuid: string; username: string; }; sessionid: string; }>;
|
||||
}
|
||||
const LceOnlineView = memo(function LceOnlineView({
|
||||
addFriendTarget,
|
||||
|
|
@ -198,16 +198,16 @@ const LceOnlineView = memo(function LceOnlineView({
|
|||
} else if (currentTab === "invites") {
|
||||
invites.forEach((inv) => {
|
||||
items.push({
|
||||
id: `invite_${inv.from}`,
|
||||
id: `invite_${inv.inviteid}`,
|
||||
type: "invite",
|
||||
label: inv.from,
|
||||
label: inv.from.username,
|
||||
onClick: () =>
|
||||
handleAction(async () => {
|
||||
const sessionId = await lceOnlineService.acceptInvite(inv.from);
|
||||
setJoinTarget({ sessionId, hostName: inv.from });
|
||||
const sessionId = await lceOnlineService.acceptInvite(inv.from.username);
|
||||
setJoinTarget({ sessionId, hostName: inv.from.username });
|
||||
}),
|
||||
onClickSecondary: () =>
|
||||
handleAction(() => lceOnlineService.declineInvite(inv.from)),
|
||||
handleAction(() => lceOnlineService.declineInvite(inv.from.username)),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { useState, useEffect, useRef } from "react";
|
|||
import { lceOnlineService } from "../services/LceOnlineService";
|
||||
export function useLceOnlineNotifications() {
|
||||
const [friendRequestMessage, setFriendRequestMessage] = useState<string | null>(null);
|
||||
const [invites, setInvites] = useState<Array<{ from: string; sessionid: string }>>([]);
|
||||
const [invites, setInvites] = useState<Array<{ inviteid: string; from: { uuid: string; username: string; }; sessionid: string; }>>([]);
|
||||
const seenRequests = useRef<Set<string>>(new Set());
|
||||
useEffect(() => {
|
||||
let pollInterval: ReturnType<typeof setInterval>;
|
||||
|
|
|
|||
|
|
@ -233,15 +233,9 @@ export class LceOnlineService {
|
|||
}
|
||||
}
|
||||
|
||||
async getInvites(): Promise<Array<{ from: string; sessionid: string }>> {
|
||||
async getInvites(): Promise<Array<{ inviteid: string; from: { uuid: string; username: string; }; sessionid: string; }>> {
|
||||
const res = await this.request<string>("GET", "/getinvites", null);
|
||||
if (typeof res !== "string") return [];
|
||||
try {
|
||||
const parsed = JSON.parse(res);
|
||||
return Array.isArray(parsed) ? parsed : [];
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
return Array.isArray(res) ? res : [];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue