mirror of
https://github.com/ershisan99/www.git
synced 2025-12-18 21:09:23 +00:00
roll back some stuff changed for debugging purposes
This commit is contained in:
@@ -30,9 +30,5 @@ const handler = (req: NextRequest) =>
|
|||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
})
|
})
|
||||||
export const config = {
|
|
||||||
api: {
|
|
||||||
responseLimit: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
export { handler as GET, handler as POST }
|
export { handler as GET, handler as POST }
|
||||||
|
|||||||
@@ -11,26 +11,23 @@ export function StreamCardClient() {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
const gamesQuery = api.history.user_games.useQuery({ user_id: id })
|
const [gamesQueryResult, gamesQuery] =
|
||||||
const gamesQueryResult = gamesQuery.data
|
api.history.user_games.useSuspenseQuery({ user_id: id })
|
||||||
const games = gamesQueryResult || [] // Ensure games is always an array
|
const games = gamesQueryResult || [] // Ensure games is always an array
|
||||||
|
|
||||||
const rankedUserQuery = api.leaderboard.get_user_rank.useQuery({
|
const [rankedUserRank, rankedUserQuery] =
|
||||||
|
api.leaderboard.get_user_rank.useSuspenseQuery({
|
||||||
channel_id: RANKED_CHANNEL,
|
channel_id: RANKED_CHANNEL,
|
||||||
user_id: id,
|
user_id: id,
|
||||||
})
|
})
|
||||||
const rankedUserRank = rankedUserQuery.data
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const interval = setInterval(async () => {
|
const interval = setInterval(async () => {
|
||||||
try {
|
|
||||||
await Promise.all([gamesQuery.refetch(), rankedUserQuery.refetch()])
|
await Promise.all([gamesQuery.refetch(), rankedUserQuery.refetch()])
|
||||||
} catch (e) {
|
}, 1000 * 60)
|
||||||
console.error('refetch failed:', e)
|
|
||||||
}
|
|
||||||
}, 1000 * 30)
|
|
||||||
|
|
||||||
return () => clearInterval(interval)
|
return () => clearInterval(interval)
|
||||||
}, [gamesQuery, rankedUserQuery])
|
}, [])
|
||||||
|
|
||||||
if (!rankedUserRank || !games?.length) {
|
if (!rankedUserRank || !games?.length) {
|
||||||
return null
|
return null
|
||||||
|
|||||||
@@ -14,14 +14,11 @@ export const history_router = createTRPCRouter({
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.query(async ({ ctx, input }) => {
|
.query(async ({ ctx, input }) => {
|
||||||
const res = await ctx.db
|
return await ctx.db
|
||||||
.select()
|
.select()
|
||||||
.from(player_games)
|
.from(player_games)
|
||||||
.where(eq(player_games.playerId, input.user_id))
|
.where(eq(player_games.playerId, input.user_id))
|
||||||
.orderBy(desc(player_games.gameNum))
|
.orderBy(desc(player_games.gameNum))
|
||||||
|
|
||||||
console.log('history.user_games', res)
|
|
||||||
return res
|
|
||||||
}),
|
}),
|
||||||
sync: publicProcedure.mutation(async () => {
|
sync: publicProcedure.mutation(async () => {
|
||||||
return syncHistory()
|
return syncHistory()
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ export const leaderboard_router = createTRPCRouter({
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.query(async ({ input }) => {
|
.query(async ({ input }) => {
|
||||||
const res = await service.getUserRank(input.channel_id, input.user_id)
|
return await service.getUserRank(input.channel_id, input.user_id)
|
||||||
console.log('leaderboard.get_user_rank', res)
|
|
||||||
return res
|
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user