Skip to content

Commit

Permalink
Fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
T-Damer committed Aug 6, 2024
1 parent e00d551 commit ca6ebd3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
7 changes: 2 additions & 5 deletions src/helpers/api/towerGame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,13 @@ export async function guess(props: {
}
}

export async function exitTower({ towerType }: { towerType: TowerType }) {
export async function exitTower(_id: string) {
try {
const { headers } = await checkAuthToken()

const { data } = await axios.post<{ balance: number }>(
backendEndpoint + '/exit',
{
towerType,
guess,
},
{ _id },
{ headers }
)
toast.success(
Expand Down
12 changes: 7 additions & 5 deletions src/pages/TowerGame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ export default function () {
return
}

console.log(isFinished, data?.betAmount)

if (!isFinished && data?.betAmount) {
try {
setInteractionLoading(true)
await exitTower({ towerType })
await exitTower(data._id)
await queryClient.invalidateQueries({
queryKey: ['hatsCounter' + address],
})
Expand All @@ -54,13 +56,13 @@ export default function () {

setBetModalOpen(true)
}, [
authenticated,
isFinished,
data?.betAmount,
refetch,
towerType,
address,
authenticated,
data?._id,
login,
address,
refetch,
])

return (
Expand Down

0 comments on commit ca6ebd3

Please sign in to comment.