7 lines
235 B
TypeScript
7 lines
235 B
TypeScript
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || ''
|
|
|
|
export function apiFetch(input: string, init?: RequestInit): Promise<Response> {
|
|
const url = input.startsWith('/') ? `${basePath}${input}` : input
|
|
return fetch(url, init)
|
|
}
|