/** Fetch wrapper for absolute app paths when Next.js basePath is enabled. */ export function appFetch(input: RequestInfo | URL, init?: RequestInit): Promise { if (typeof input !== 'string' || !input.startsWith('/') || input.startsWith('//')) { return fetch(input, init); } const basePath = process.env.NEXT_PUBLIC_APP_BASE_PATH ?? ''; return fetch(`${basePath}${input}`, init); }