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}` : "",
        };
      },
    }),
  ],
});
