fix(client): append base url on api client req

Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
2026-03-15 16:53:32 +00:00
parent 8e7bce101d
commit f0a4c095b9

View File

@@ -28,7 +28,9 @@ export class ApiClient {
const finalInit = init
? this.middlewares.reduce((prevInit, middleware) => middleware(url, prevInit), init)
: undefined
return fetch(url, finalInit).then((res) => Promise.all([Promise.resolve(res), res.json()]))
return fetch(url instanceof Request ? url : new URL(url, this.baseUrl), finalInit).then((res) =>
Promise.all([Promise.resolve(res), res.json()]),
)
}
}