feat: switched from worker API to fs based

This commit is contained in:
Morten Olsen
2024-01-12 14:14:40 +01:00
parent 6d8e5bf955
commit 59d6faaafc
38 changed files with 458 additions and 67 deletions

View File

@@ -2,13 +2,20 @@ import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
import superjson from 'superjson';
import type { Runtime } from '@morten-olsen/mini-loader-server';
import type { RootRouter } from '@morten-olsen/mini-loader-server';
import { Context } from '../context/context.js';
const createClient = () => {
const createClient = (context: Context) => {
if (!context.host || !context.token) {
throw new Error('Not signed in');
}
const client = createTRPCProxyClient<RootRouter>({
transformer: superjson,
links: [
httpBatchLink({
url: 'http://localhost:4500/trpc',
url: `${context.host}/trpc`,
headers: {
authorization: `Bearer ${context.token}`,
},
}),
],
});