mirror of
https://github.com/kennethnym/aris.git
synced 2026-03-20 00:51:20 +00:00
fix(client): append base url on api client req
Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
@@ -28,7 +28,9 @@ export class ApiClient {
|
|||||||
const finalInit = init
|
const finalInit = init
|
||||||
? this.middlewares.reduce((prevInit, middleware) => middleware(url, prevInit), init)
|
? this.middlewares.reduce((prevInit, middleware) => middleware(url, prevInit), init)
|
||||||
: undefined
|
: 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()]),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user