mirror of
https://github.com/ershisan99/www.git
synced 2025-12-18 05:19: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,
|
||||
})
|
||||
export const config = {
|
||||
api: {
|
||||
responseLimit: false,
|
||||
},
|
||||
}
|
||||
|
||||
export { handler as GET, handler as POST }
|
||||
|
||||
@@ -11,26 +11,23 @@ export function StreamCardClient() {
|
||||
return null
|
||||
}
|
||||
|
||||
const gamesQuery = api.history.user_games.useQuery({ user_id: id })
|
||||
const gamesQueryResult = gamesQuery.data
|
||||
const [gamesQueryResult, gamesQuery] =
|
||||
api.history.user_games.useSuspenseQuery({ user_id: id })
|
||||
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,
|
||||
user_id: id,
|
||||
})
|
||||
const rankedUserRank = rankedUserQuery.data
|
||||
|
||||
useEffect(() => {
|
||||
const interval = setInterval(async () => {
|
||||
try {
|
||||
await Promise.all([gamesQuery.refetch(), rankedUserQuery.refetch()])
|
||||
} catch (e) {
|
||||
console.error('refetch failed:', e)
|
||||
}
|
||||
}, 1000 * 30)
|
||||
}, 1000 * 60)
|
||||
|
||||
return () => clearInterval(interval)
|
||||
}, [gamesQuery, rankedUserQuery])
|
||||
}, [])
|
||||
|
||||
if (!rankedUserRank || !games?.length) {
|
||||
return null
|
||||
|
||||
@@ -14,14 +14,11 @@ export const history_router = createTRPCRouter({
|
||||
})
|
||||
)
|
||||
.query(async ({ ctx, input }) => {
|
||||
const res = await ctx.db
|
||||
return await ctx.db
|
||||
.select()
|
||||
.from(player_games)
|
||||
.where(eq(player_games.playerId, input.user_id))
|
||||
.orderBy(desc(player_games.gameNum))
|
||||
|
||||
console.log('history.user_games', res)
|
||||
return res
|
||||
}),
|
||||
sync: publicProcedure.mutation(async () => {
|
||||
return syncHistory()
|
||||
|
||||
@@ -24,8 +24,6 @@ export const leaderboard_router = createTRPCRouter({
|
||||
})
|
||||
)
|
||||
.query(async ({ input }) => {
|
||||
const res = await service.getUserRank(input.channel_id, input.user_id)
|
||||
console.log('leaderboard.get_user_rank', res)
|
||||
return res
|
||||
return await service.getUserRank(input.channel_id, input.user_id)
|
||||
}),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user