diff --git a/src/components/header.vue b/src/components/header.vue index 5d4018a..0504cc1 100644 --- a/src/components/header.vue +++ b/src/components/header.vue @@ -54,20 +54,20 @@ export default { let id = this.input.trim() if (id) { fetch('/package/search/' + encodeURIComponent(id)).then(r => { - // let list = r.data.map(it => it.split('/')) let dict = { versions: [], id } let last = null for (let it of r.data) { let tmp = it.split('/') - if (tmp.length === 1) { - last = it - dict.versions.push(last) - dict[last] = [] + let v = tmp.shift() + let n = tmp.join('/') + if (last === v) { + dict[last].push(n) } else { - dict[last].push(it) + last = v + dict.versions.push(last) + dict[last] = [n] } } - console.log(dict) this.$store.result = dict }) } else { diff --git a/src/lib/fetch.js b/src/lib/fetch.js index 03dd34a..3d63521 100644 --- a/src/lib/fetch.js +++ b/src/lib/fetch.js @@ -1,6 +1,6 @@ import fetch from 'fetch' -fetch.BASE_URL = '//api.jscdn.ink' +fetch.BASE_URL = 'https://api.jscdn.ink' fetch.inject.request(function (conf) { var token = localStorage.getItem('token') diff --git a/src/views/home.vue b/src/views/home.vue index 9b682cc..f767c54 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -1,6 +1,6 @@