Skip to content

Commit

Permalink
feat(types): add typings to axios config in nuxt.config (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieutu authored May 3, 2020
1 parent 0f20c51 commit 0957082
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,28 @@ interface NuxtAxiosInstance extends AxiosStatic {
onResponseError(callback: (error: AxiosError) => void): void
}

interface AxiosOptions {
baseURL?: string,
browserBaseURL?: string,
credentials?: boolean,
debug?: boolean,
progress?: boolean,
proxyHeaders?: boolean,
proxyHeadersIgnore?: string[],
proxy?: boolean,
retry?: boolean,
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 '@nuxt/vue-app' {
interface Context {
$axios: NuxtAxiosInstance
Expand All @@ -37,9 +59,14 @@ declare module '@nuxt/types' {
interface Context {
$axios: NuxtAxiosInstance
}

interface NuxtAppOptions {
$axios: NuxtAxiosInstance
}

interface Configuration {
axios?: AxiosOptions
}
}

declare module 'vue/types/vue' {
Expand Down

0 comments on commit 0957082

Please sign in to comment.