/** * `$api` — $fetch bound to the backend. During SSR it calls the API directly over the internal * network; in the browser it uses the same-origin `/api` path. */ export default defineNuxtPlugin(() => { const config = useRuntimeConfig(); const api = $fetch.create({ baseURL: import.meta.server ? config.apiInternalUrl : config.public.apiBase, retry: import.meta.server ? 1 : 0, }); return { provide: { api } }; });