-
Notifications
You must be signed in to change notification settings - Fork 243
/
Copy pathindex.d.ts
48 lines (42 loc) · 1.63 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { AxiosError, AxiosRequestConfig, AxiosResponse, AxiosStatic } from 'axios'
import Vue from 'vue'
import './vuex'
interface NuxtAxiosInstance extends AxiosStatic {
$request<T = any>(config: AxiosRequestConfig): Promise<T>
$get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>
$delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>
$head<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>
$options<T = any>(url: string, 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>
$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
onResponseError(callback: (error: AxiosError) => void): void
}
declare module '@nuxt/vue-app' {
interface Context {
$axios: NuxtAxiosInstance
}
interface NuxtAppOptions {
$axios: NuxtAxiosInstance
}
}
// Nuxt 2.9+
declare module '@nuxt/types' {
interface Context {
$axios: NuxtAxiosInstance
}
interface NuxtAppOptions {
$axios: NuxtAxiosInstance
}
}
declare module 'vue/types/vue' {
interface Vue {
$axios: NuxtAxiosInstance
}
}