mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 15:53:02 +10:00
wip: refresh design
This commit is contained in:
7
packages/trpc/client/guards.ts
Normal file
7
packages/trpc/client/guards.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { TRPCClientError } from '@trpc/client';
|
||||
|
||||
import { AppRouter } from '../server/router';
|
||||
|
||||
export const isTRPCBadRequestError = (err: unknown): err is TRPCClientError<AppRouter> => {
|
||||
return err instanceof TRPCClientError && err.shape?.code === 'BAD_REQUEST';
|
||||
};
|
||||
18
packages/trpc/client/index.ts
Normal file
18
packages/trpc/client/index.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
|
||||
import SuperJSON from 'superjson';
|
||||
|
||||
import { getBaseUrl } from '@documenso/lib/universal/get-base-url';
|
||||
|
||||
import { AppRouter } from '../server/router';
|
||||
|
||||
export const trpc = createTRPCProxyClient<AppRouter>({
|
||||
transformer: SuperJSON,
|
||||
|
||||
links: [
|
||||
httpBatchLink({
|
||||
url: `${getBaseUrl()}/api/trpc`,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
export { TRPCClientError } from '@trpc/client';
|
||||
Reference in New Issue
Block a user