统一盲盒请求契约并移除冗余 userId 参数

This commit is contained in:
2026-03-03 13:11:33 +08:00
parent 4a5ed3b25a
commit 532d8ff7ad
7 changed files with 30 additions and 34 deletions
+3 -4
View File
@@ -172,7 +172,7 @@ export default function BlindboxLobbyPage() {
const [showAuth, setShowAuth] = useState(false);
const toast = useToast();
const { rooms: swrRooms, isLoading: swrLoading, isUnauthorized, error: swrError, mutate: mutateRooms } = useBlindboxRooms(
loggedIn && profile ? profile.id : undefined,
loggedIn,
);
const rooms = swrRooms;
const loading = !loggedIn ? false : swrLoading;
@@ -233,7 +233,7 @@ export default function BlindboxLobbyPage() {
const res = await fetch("/api/blindbox/room", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ userId: profile.id, name: name || undefined }),
body: JSON.stringify({ name: name || undefined }),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error);
@@ -254,7 +254,7 @@ export default function BlindboxLobbyPage() {
const res = await fetch("/api/blindbox/room/join", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ userId: profile.id, code }),
body: JSON.stringify({ code }),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error);
@@ -273,7 +273,6 @@ export default function BlindboxLobbyPage() {
const res = await fetch(`/api/blindbox/room/${room.code}`, {
method: "DELETE",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ userId: profile.id }),
});
if (!res.ok) {
const data = await res.json();