import aboutApi from '~/api/about';
import toolApi from '@/api/tools';
import CommentApi from '~/api/comment';
import articleApi from '~/api/article';
import configApi from '~/api/config';

/**
 * 将api注入到全局
 *
 * 在页面或组件里使用
 *  async mounted() {
        const games = await this.$api.game.getGameList({ page: 1 })
    }

    async asyncData({ app }) {
        const games = await app.$api.game.getGameList({ page: 1 })
    },

 */
export default ({ $axios }, inject) => {
    const api = {
        tool: toolApi($axios),
        about: aboutApi($axios),
		comment: CommentApi($axios),
		article: articleApi($axios),
		config: configApi($axios),
    }

    inject('api', api) // 将api注入到全局
}
