update stream card, update leaderboards on match finished webhook

This commit is contained in:
2025-04-24 00:58:22 +02:00
parent 002fdd4c6d
commit 68540ee136
9 changed files with 362 additions and 63 deletions

View File

@@ -1,7 +1,12 @@
'use client'
import { type QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { httpBatchLink, httpBatchStreamLink, loggerLink } from '@trpc/client'
import {
httpBatchLink,
httpSubscriptionLink,
loggerLink,
splitLink,
} from '@trpc/client'
import { createTRPCReact } from '@trpc/react-query'
import type { inferRouterInputs, inferRouterOutputs } from '@trpc/server'
import { useState } from 'react'
@@ -49,14 +54,24 @@ export function TRPCReactProvider(props: { children: React.ReactNode }) {
process.env.NODE_ENV === 'development' ||
(op.direction === 'down' && op.result instanceof Error),
}),
httpBatchLink({
transformer: SuperJSON,
url: `${getBaseUrl()}/api/trpc`,
headers: () => {
const headers = new Headers()
headers.set('x-trpc-source', 'nextjs-react')
return headers
splitLink({
condition(op) {
return op.type === 'subscription'
},
true: httpSubscriptionLink({
url: `${getBaseUrl()}/api/trpc`,
transformer: SuperJSON,
}),
false: httpBatchLink({
transformer: SuperJSON,
url: `${getBaseUrl()}/api/trpc`,
headers: () => {
const headers = new Headers()
headers.set('x-trpc-source', 'nextjs-react')
return headers
},
}),
}),
],
})