统一盲盒请求契约并移除冗余 userId 参数
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user