mirror of https://github.com/sundowndev/http.git
fix(types): add missing types for `create` and `setBaseURL` (#122)
* fix: add missing types for `create` and `setBaseURL` * fix: correct `create` return typemaster
parent
9499d0f14b
commit
c002aaa97c
|
@ -104,6 +104,12 @@ interface NuxtHTTPInstance {
|
||||||
$delete<T = unknown>(url: Request | URL | string, options?: Options): Promise<T>;
|
$delete<T = unknown>(url: Request | URL | string, options?: Options): Promise<T>;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the baseURL for all subsequent requests.
|
||||||
|
* @param baseURL - the base URL (e.g. `https://myapi.com/`)
|
||||||
|
*/
|
||||||
|
setBaseURL(baseURL: string): void
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a header on all subsequent requests.
|
* Set a header on all subsequent requests.
|
||||||
* @param name - Header name.
|
* @param name - Header name.
|
||||||
|
@ -146,6 +152,11 @@ interface NuxtHTTPInstance {
|
||||||
* This hook enables you to globally handle request errors.
|
* This hook enables you to globally handle request errors.
|
||||||
*/
|
*/
|
||||||
onError(hook: (error: ky.HTTPError) => void): void
|
onError(hook: (error: ky.HTTPError) => void): void
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If you need to create your own ky instance which based on $http defaults, you can use the create(options) method.
|
||||||
|
*/
|
||||||
|
create(options: Partial<Options>): NuxtHTTPInstance
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '@nuxt/vue-app' {
|
declare module '@nuxt/vue-app' {
|
||||||
|
|
Loading…
Reference in New Issue