Files
sorvor-front/src/utils/trpc.js

17 lines
394 B
JavaScript

import { httpBatchLink, createTRPCProxyClient } from "@trpc/client";
import { CONFIG } from "@/config";
export const client = createTRPCProxyClient({
links: [
httpBatchLink({
url: CONFIG.api_url,
headers: () => {
let token = localStorage.getItem("token");
return {
Authorization: token ? `Bearer ${token}` : "",
};
},
}),
],
});