refactor: rename axios to got

This commit is contained in:
DIYgod
2019-06-03 18:03:05 +08:00
parent c4bf4fcdb4
commit a56c0b5a39
629 changed files with 1552 additions and 1552 deletions

View File

@@ -1,4 +1,4 @@
const axios = require('@/utils/axios');
const got = require('@/utils/got');
const cheerio = require('cheerio');
const BASE_URL = 'https://minecraft.curseforge.com/';
@@ -6,7 +6,7 @@ const BASE_URL = 'https://minecraft.curseforge.com/';
module.exports = async (ctx) => {
const { project } = ctx.params;
const projectLink = `${BASE_URL}/projects/${project}/files`;
const projectFilesReq = await axios.get(projectLink);
const projectFilesReq = await got.get(projectLink);
const { data } = projectFilesReq;
const $ = cheerio.load(data);
const projectName = $('.project-title span').text();
@@ -23,7 +23,7 @@ module.exports = async (ctx) => {
return JSON.parse(cache);
}
const itemReq = await axios.get(document.link);
const itemReq = await got.get(document.link);
const $item = cheerio.load(itemReq.data);
const supportVersions = $item('.details-versions li')
.get()