Files
Montech_Landing/apps/landing/composables/useMontechApi.ts
T
MahdiandCursor b0088c35d1 Replace the landing with the artifact design and rebuild the admin in Ant Design.
Adds consultation leads, section editors, and the one-time content reset for this release.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-01 20:36:06 +03:30

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>;
}