2026-04-27 11:20:47 -05:00
|
|
|
import createClient from "openapi-fetch";
|
2026-04-24 16:52:40 -05:00
|
|
|
import { loadConfig } from "@/lib/config";
|
2026-06-02 11:47:24 -05:00
|
|
|
import { dispatchFor } from "@/lib/dispatch";
|
2026-04-24 21:30:48 -05:00
|
|
|
import type { paths } from "./schema.d.ts";
|
|
|
|
|
|
|
|
|
|
export function createHonchoClient() {
|
2026-06-02 11:47:24 -05:00
|
|
|
const config = loadConfig() ?? { baseUrl: "http://localhost:8000", token: "" };
|
|
|
|
|
const { baseUrl, headers, fetch } = dispatchFor(config);
|
|
|
|
|
return createClient<paths>({ baseUrl, headers, fetch });
|
2026-04-24 21:30:48 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const client = {
|
|
|
|
|
get current() {
|
|
|
|
|
return createHonchoClient();
|
|
|
|
|
},
|
|
|
|
|
};
|