Adds consultation leads, section editors, and the one-time content reset for this release. Co-authored-by: Cursor <cursoragent@cursor.com>
13 lines
537 B
TypeScript
13 lines
537 B
TypeScript
import type { NitroFetchOptions, NitroFetchRequest } from "nitropack";
|
|
|
|
/** SSR talks to the API directly; the browser uses same-origin `/api` (nginx in production, devProxy locally). */
|
|
export function useApiBase(): string {
|
|
const config = useRuntimeConfig();
|
|
if (import.meta.server) return config.apiBase;
|
|
return config.public.apiBase || "";
|
|
}
|
|
|
|
export function apiFetch<T>(path: string, options?: NitroFetchOptions<NitroFetchRequest>): Promise<T> {
|
|
return $fetch<T>(`${useApiBase()}${path}`, options as never) as Promise<T>;
|
|
}
|