This repository was archived by the owner on Jul 10, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change 1+ import { AxiosInstance , AxiosRequestConfig , AxiosError } from 'axios'
12import Vue from 'vue'
23
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+
336declare module 'vue/types/vue' {
437 interface Vue {
5- $axios : any
38+ $axios : NuxtAxiosInstance
639 }
740}
You can’t perform that action at this time.
0 commit comments