mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
27 lines
613 B
TypeScript
27 lines
613 B
TypeScript
import { createTRPCClient, httpBatchLink, TRPCClient } from '@trpc/client';
|
|
|
|
//@ts-ignore
|
|
import type { AppRouter as EmailsAppRouter } from '../../emails/src/index'
|
|
|
|
class TRPC {
|
|
|
|
public client: TRPCClient<EmailsAppRouter>
|
|
|
|
init(url: string, secret: string) {
|
|
this.client = createTRPCClient<EmailsAppRouter>({
|
|
links: [
|
|
httpBatchLink({
|
|
url,
|
|
headers: {
|
|
Authorization: `Bearer ${secret}`
|
|
}
|
|
}),
|
|
],
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
export const TrcpInstance = new TRPC();
|
|
|