This repository was archived by the owner on Jul 10, 2019. It is now read-only.
File tree 1 file changed +34
-1
lines changed
1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change
1
+ import { AxiosInstance , AxiosRequestConfig , AxiosError } from 'axios'
1
2
import Vue from 'vue'
2
3
4
+ interface NuxtAxiosInstance extends AxiosInstance {
5
+ // * Methods
6
+ $request < T = any > ( config : AxiosRequestConfig ) : Promise < T >
7
+ $get < T = any > ( url : string , config ?: AxiosRequestConfig ) : Promise < T >
8
+ $delete < T = any > ( url : string , config ?: AxiosRequestConfig ) : Promise < T >
9
+ $head < T = any > ( url : string , config ?: AxiosRequestConfig ) : Promise < T >
10
+ $options < T = any > ( url : string , config ?: AxiosRequestConfig ) : Promise < T >
11
+ $post < T = any > (
12
+ url : string ,
13
+ data ?: any ,
14
+ config ?: AxiosRequestConfig
15
+ ) : Promise < T >
16
+ $put < T = any > (
17
+ url : string ,
18
+ data ?: any ,
19
+ config ?: AxiosRequestConfig
20
+ ) : Promise < T >
21
+ $patch < T = any > (
22
+ url : string ,
23
+ data ?: any ,
24
+ config ?: AxiosRequestConfig
25
+ ) : Promise < T >
26
+ // * Helpers
27
+ onRequest ( fn : ( config : AxiosRequestConfig ) => void ) : void
28
+ onResponse < T = any > ( fn : ( response : T ) => void ) : void
29
+ onError ( fn : ( error : AxiosError ) => void ) : void
30
+ onRequestError ( fn : ( error : AxiosError ) => void ) : void
31
+ onResponseError ( fn : ( error : AxiosError ) => void ) : void
32
+ setHeader ( name : string , value : any , scopes ?: string | string [ ] ) : void
33
+ setToken ( token : string , type : string , scopes ?: string | string [ ] ) : void
34
+ }
35
+
3
36
declare module 'vue/types/vue' {
4
37
interface Vue {
5
- $axios : any
38
+ $axios : NuxtAxiosInstance
6
39
}
7
40
}
You can’t perform that action at this time.
0 commit comments