mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-11 08:18:37 +01:00
new selfhosted version
This commit is contained in:
26
consumer/src/trpc.ts
Normal file
26
consumer/src/trpc.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user