Skip to content

Commit 2573776

Browse files
committed
fix: 🐛 urlParam of language
Fix replace regex
1 parent 61b218b commit 2573776

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/languages.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ import state from '../store/state'
7777
import axios from 'axios'
7878
function fetchGalleries(results) {
7979
return Promise.all(results.map(record => {
80-
return axios.get('https://github-trending-api.now.sh/repositories?language=' + record.urlParam)
80+
return axios.get('https://github-trending-api.now.sh/repositories?language=' + encodeURIComponent(record.urlParam))
8181
})).then(gal => {
8282
var papa = gal.filter(function (el) {
8383
return el.data.length > 0
@@ -127,7 +127,7 @@ export default {
127127
var papa = fetchGalleries(vm.results)
128128
papa.then(result => {
129129
vm.wt = result.map(a => {
130-
var url = a.toLowerCase().replace(' ', '-')
130+
var url = a.replace(/\s+/g, '-').toLowerCase()
131131
return {
132132
name: a,
133133
urlParam: url

0 commit comments

Comments
 (0)