mirror of
https://github.com/spliit-app/spliit.git
synced 2026-02-14 19:46:12 +01:00
* Add tRPC, use it for group expense list * Use tRPC for balances * Use tRPC in group information + better loading states
26 lines
626 B
TypeScript
26 lines
626 B
TypeScript
import { initTRPC } from '@trpc/server'
|
|
import { cache } from 'react'
|
|
import superjson from 'superjson'
|
|
|
|
export const createTRPCContext = cache(async () => {
|
|
/**
|
|
* @see: https://trpc.io/docs/server/context
|
|
*/
|
|
return {}
|
|
})
|
|
|
|
// Avoid exporting the entire t-object
|
|
// since it's not very descriptive.
|
|
// For instance, the use of a t variable
|
|
// is common in i18n libraries.
|
|
const t = initTRPC.create({
|
|
/**
|
|
* @see https://trpc.io/docs/server/data-transformers
|
|
*/
|
|
transformer: superjson,
|
|
})
|
|
|
|
// Base router and procedure helpers
|
|
export const createTRPCRouter = t.router
|
|
export const baseProcedure = t.procedure
|