Skip to content

Commit 0957082

Browse files
authored
feat(types): add typings to axios config in nuxt.config (#357)
1 parent 0f20c51 commit 0957082

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

types/index.d.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,28 @@ interface NuxtAxiosInstance extends AxiosStatic {
2323
onResponseError(callback: (error: AxiosError) => void): void
2424
}
2525

26+
interface AxiosOptions {
27+
baseURL?: string,
28+
browserBaseURL?: string,
29+
credentials?: boolean,
30+
debug?: boolean,
31+
progress?: boolean,
32+
proxyHeaders?: boolean,
33+
proxyHeadersIgnore?: string[],
34+
proxy?: boolean,
35+
retry?: boolean,
36+
https?: boolean,
37+
headers?: {
38+
common?: Record<string, string>,
39+
delete?: Record<string, string>,
40+
get?: Record<string, string>,
41+
head?: Record<string, string>,
42+
post?: Record<string, string>,
43+
put?: Record<string, string>,
44+
patch?: Record<string, string>,
45+
},
46+
}
47+
2648
declare module '@nuxt/vue-app' {
2749
interface Context {
2850
$axios: NuxtAxiosInstance
@@ -37,9 +59,14 @@ declare module '@nuxt/types' {
3759
interface Context {
3860
$axios: NuxtAxiosInstance
3961
}
62+
4063
interface NuxtAppOptions {
4164
$axios: NuxtAxiosInstance
4265
}
66+
67+
interface Configuration {
68+
axios?: AxiosOptions
69+
}
4370
}
4471

4572
declare module 'vue/types/vue' {

0 commit comments

Comments
 (0)