mirror of https://github.com/sundowndev/http.git
feat(types): add types for helper functions (#193)
parent
3164d8fd29
commit
79909cc3ba
|
@ -1,4 +1,4 @@
|
||||||
import { AxiosInstance, AxiosRequestConfig } from 'axios'
|
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
interface NuxtAxiosInstance extends AxiosInstance {
|
interface NuxtAxiosInstance extends AxiosInstance {
|
||||||
|
@ -10,6 +10,15 @@ interface NuxtAxiosInstance extends AxiosInstance {
|
||||||
$post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
|
$post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
|
||||||
$put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
|
$put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
|
||||||
$patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
|
$patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
|
||||||
|
|
||||||
|
setHeader(name: string, value?: string | false, scopes?: string | string[]): void;
|
||||||
|
setToken(token: string | false, type?: string, scopes?: string | string[]): void;
|
||||||
|
|
||||||
|
onRequest(callback: (config: AxiosRequestConfig) => void): void;
|
||||||
|
onResponse<T = any>(callback: (response: AxiosResponse<T>) => void): void;
|
||||||
|
onError(callback: (error: AxiosError) => void): void;
|
||||||
|
onRequestError(callback: (error: AxiosError) => void): void;
|
||||||
|
onResponseErro(callback: (error: AxiosError) => void): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'vue/types/vue' {
|
declare module 'vue/types/vue' {
|
||||||
|
|
Loading…
Reference in New Issue