From 6ef1a6f16434be437487ee3db102a125c640c77f Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sat, 5 Sep 2020 15:35:53 +0200 Subject: [PATCH] fix(api): fix typescript issues with Axios instance parameter in API plugins --- plugins/imageApi.ts | 3 ++- plugins/itemsApi.ts | 3 ++- plugins/userApi.ts | 3 ++- plugins/userViewsApi.ts | 7 ++++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/imageApi.ts b/plugins/imageApi.ts index ed7921d3..c229dcda 100644 --- a/plugins/imageApi.ts +++ b/plugins/imageApi.ts @@ -1,4 +1,5 @@ import { Context } from '@nuxt/types'; +import { AxiosInstance } from 'axios'; import { ImageApi } from '~/api/api'; import { Configuration } from '~/api/configuration'; import { PluginInjection } from '~/types/utils'; @@ -22,6 +23,6 @@ declare module 'vue/types/vue' { export default (context: Context, inject: PluginInjection): void => { const config = new Configuration(); - const imageApi = new ImageApi(config, '', context.$axios); + const imageApi = new ImageApi(config, '', context.$axios as AxiosInstance); inject('imageApi', imageApi); }; diff --git a/plugins/itemsApi.ts b/plugins/itemsApi.ts index b1fa8e75..e57bd01b 100644 --- a/plugins/itemsApi.ts +++ b/plugins/itemsApi.ts @@ -1,4 +1,5 @@ import { Context } from '@nuxt/types'; +import { AxiosInstance } from 'axios'; import { ItemsApi } from '~/api/api'; import { Configuration } from '~/api/configuration'; import { PluginInjection } from '~/types/utils'; @@ -22,6 +23,6 @@ declare module 'vue/types/vue' { export default (context: Context, inject: PluginInjection): void => { const config = new Configuration(); - const itemsApi = new ItemsApi(config, '', context.$axios); + const itemsApi = new ItemsApi(config, '', context.$axios as AxiosInstance); inject('itemsApi', itemsApi); }; diff --git a/plugins/userApi.ts b/plugins/userApi.ts index 0268ee1c..fe979c34 100644 --- a/plugins/userApi.ts +++ b/plugins/userApi.ts @@ -1,4 +1,5 @@ import { Context } from '@nuxt/types'; +import { AxiosInstance } from 'axios'; import { UserApi } from '~/api/api'; import { Configuration } from '~/api/configuration'; import { PluginInjection } from '~/types/utils'; @@ -22,6 +23,6 @@ declare module 'vue/types/vue' { export default (context: Context, inject: PluginInjection): void => { const config = new Configuration(); - const userApi = new UserApi(config, '', context.$axios); + const userApi = new UserApi(config, '', context.$axios as AxiosInstance); inject('userApi', userApi); }; diff --git a/plugins/userViewsApi.ts b/plugins/userViewsApi.ts index cf0d17c8..8999878c 100644 --- a/plugins/userViewsApi.ts +++ b/plugins/userViewsApi.ts @@ -1,4 +1,5 @@ import { Context } from '@nuxt/types'; +import { AxiosInstance } from 'axios'; import { UserViewsApi } from '~/api/api'; import { Configuration } from '~/api/configuration'; import { PluginInjection } from '~/types/utils'; @@ -22,6 +23,10 @@ declare module 'vue/types/vue' { export default (context: Context, inject: PluginInjection): void => { const config = new Configuration(); - const userViewsApi = new UserViewsApi(config, '', context.$axios); + const userViewsApi = new UserViewsApi( + config, + '', + context.$axios as AxiosInstance + ); inject('userViewsApi', userViewsApi); };