amati/apps/frontend/src/honoClient.ts
2024-05-08 01:27:56 +07:00

17 lines
394 B
TypeScript

import { hc } from "hono/client";
import { AppType } from "backend";
const backendUrl = import.meta.env.VITE_BACKEND_BASE_URL as string | undefined;
console.log(backendUrl);
if (!backendUrl) throw new Error("Backend URL not set");
const client = hc<AppType>(backendUrl, {
headers: () => ({
Authorization: `Bearer ${localStorage.getItem("accessToken")}`,
}),
});
export default client;