tRPC Hinzugefügt

This commit is contained in:
Moritz Utcke
2024-01-07 22:58:12 +07:00
parent dfd7cce6c8
commit ff16c3b547
39 changed files with 1302 additions and 1652 deletions

16
src/trpc.ts Normal file
View File

@@ -0,0 +1,16 @@
import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
import cookies from 'js-cookie';
import type { AppRouter } from 'src/pages/api/trpc/[trpc]';
export default createTRPCProxyClient<AppRouter>({
links: [
httpBatchLink({
url: 'http://localhost:3000/api/trpc',
headers() {
return {
'Authorization': `Bearer ${cookies.get('uid')}`,
};
},
}),
],
});