fix(api): fix typescript issues with Axios instance parameter in API plugins

This commit is contained in:
MrTimscampi 2020-09-05 15:35:53 +02:00
parent c4fd2fbdac
commit 6ef1a6f164
4 changed files with 12 additions and 4 deletions

View File

@ -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);
};

View File

@ -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);
};

View File

@ -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);
};

View File

@ -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);
};