fix(gateway): decouple admin navigation loading
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
|
||||
import { createTRPCProxyClient, httpBatchLink, httpLink } from '@trpc/client';
|
||||
import type { AppRouter } from '@sammo-ts/gateway-api';
|
||||
|
||||
const getSessionToken = (): string | null => {
|
||||
@@ -19,3 +19,15 @@ export const trpc = createTRPCProxyClient<AppRouter>({
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
export const directTrpc = createTRPCProxyClient<AppRouter>({
|
||||
links: [
|
||||
httpLink({
|
||||
url: import.meta.env.VITE_GATEWAY_API_URL ?? '/api/trpc',
|
||||
headers() {
|
||||
const token = getSessionToken();
|
||||
return token ? { 'x-session-token': token } : {};
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user