httpBatchLink
wsLink
splitLink
export const api = createTRPCClient<AppRouter & WebSocketRouter>({ links: [ splitLink({ condition(op) { return op.type === "subscription"; }, true: wsLink({ client: wsClient, transformer: superjson, }), false: httpBatchLink({ url: import.meta.env.PROD ? `/trpc` : `http://localhost:3000/trpc`, transformer: superjson, }), }), ],});
const { mutateAsync } = trpc.shop.buyShopItem.useMutation({ retry: (failCount, error) => { if (failCount >= 5) return false; if (error.data?.code == "UNAUTHORIZED") return false; return true; },});