Skip to content

Commit 79909cc

Browse files
hmskpi0
authored andcommitted
feat(types): add types for helper functions (#193)
1 parent 3164d8f commit 79909cc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Diff for: index.d.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AxiosInstance, AxiosRequestConfig } from 'axios'
1+
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'
22
import Vue from 'vue'
33

44
interface NuxtAxiosInstance extends AxiosInstance {
@@ -10,6 +10,15 @@ interface NuxtAxiosInstance extends AxiosInstance {
1010
$post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
1111
$put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
1212
$patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
13+
14+
setHeader(name: string, value?: string | false, scopes?: string | string[]): void;
15+
setToken(token: string | false, type?: string, scopes?: string | string[]): void;
16+
17+
onRequest(callback: (config: AxiosRequestConfig) => void): void;
18+
onResponse<T = any>(callback: (response: AxiosResponse<T>) => void): void;
19+
onError(callback: (error: AxiosError) => void): void;
20+
onRequestError(callback: (error: AxiosError) => void): void;
21+
onResponseErro(callback: (error: AxiosError) => void): void;
1322
}
1423

1524
declare module 'vue/types/vue' {

0 commit comments

Comments
 (0)