Little fix

This commit is contained in:
aronmal 2023-04-15 12:10:56 +02:00
parent 549d0f1d77
commit b9e72b2a32
Signed by: aronmal
GPG key ID: 816B7707426FC612

View file

@ -48,15 +48,14 @@ export default function Home({ q }: Props) {
})
.optional(),
})
const gamePromise = getAccessToken().then((token) => {
console.log(otp, { ...token, pin })
return fetch("/api/game/" + (!pin ? "create" : "join"), {
const gamePromise = getAccessToken().then((token) =>
fetch("/api/game/" + (!pin ? "create" : "join"), {
method: "POST",
body: JSON.stringify({ ...token, pin: pin }),
body: JSON.stringify({ token, pin }),
})
.then(successfulResponse)
.then((game) => createSchema.parse(game))
})
)
const res = await toast.promise(gamePromise, {
pending: {
@ -103,7 +102,7 @@ export default function Home({ q }: Props) {
return
}
gameFetch(otp)
}, [otp])
}, [otp, gameFetch])
return (
<div className="h-full bg-theme">