保誠-保戶業務員媒合平台
HelenHuang
2022-06-09 9bdb95c9e34cef640534e5e5a1e2225a80442000
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import { AxiosError, AxiosRequestConfig, AxiosResponse, AxiosStatic } from 'axios'
import { IAxiosRetryConfig } from 'axios-retry'
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>
 
  setBaseURL(baseURL: string): void
  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 | AxiosRequestConfig | Promise<AxiosRequestConfig>): void
  onResponse<T = any>(callback: (response: AxiosResponse<T>) => void | AxiosResponse<T> | Promise<AxiosResponse<T>> ): void
  onError(callback: (error: AxiosError) => any): void
  onRequestError(callback: (error: AxiosError) => any): void 
  onResponseError(callback: (error: AxiosError) => any): void
 
  create(options?: AxiosRequestConfig): NuxtAxiosInstance
}
 
interface AxiosOptions {
  baseURL?: string,
  browserBaseURL?: string,
  credentials?: boolean,
  debug?: boolean,
  host?: string,
  prefix?: string,
  progress?: boolean,
  proxyHeaders?: boolean,
  proxyHeadersIgnore?: string[],
  proxy?: boolean,
  port?: string | number,
  retry?: boolean | IAxiosRetryConfig,
  https?: boolean,
  headers?: {
    common?: Record<string, string>,
    delete?: Record<string, string>,
    get?: Record<string, string>,
    head?: Record<string, string>,
    post?: Record<string, string>,
    put?: Record<string, string>,
    patch?: Record<string, string>,
  },
}
 
declare module 'axios' {
    interface AxiosRequestConfig {
        progress?: boolean;
    }
}
 
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
  }
 
  interface Configuration {
    axios?: AxiosOptions
  }
}
 
declare module 'vue/types/vue' {
  interface Vue {
    $axios: NuxtAxiosInstance
  }
}