Skip to content

Commit

Permalink
Merge pull request #1730 from NatLibFi/issue1703-search-page-url-cons…
Browse files Browse the repository at this point in the history
…truction

Simplify search page URL construction
  • Loading branch information
osma authored Dec 19, 2024
2 parents 8c9ac99 + 17d5e93 commit f1cec44
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions resource/js/vocab-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,9 @@ const vocabSearch = Vue.createApp({
gotoSearchPage () {
if (!this.searchTerm) return

const currentVocab = window.SKOSMOS.vocab + '/' + window.SKOSMOS.lang + '/'
const vocabHref = window.location.href.substring(0, window.location.href.lastIndexOf(window.SKOSMOS.vocab)) + currentVocab
const searchUrlParams = new URLSearchParams({ clang: window.SKOSMOS.content_lang, q: this.searchTerm })
if (this.selectedLanguage === 'all') searchUrlParams.set('anylang', 'true')
const searchUrl = vocabHref + 'search?' + searchUrlParams.toString()
const searchUrl = window.SKOSMOS.vocab + '/' + window.SKOSMOS.lang + '/search?' + searchUrlParams.toString()
window.location.href = searchUrl
},
changeLang (clang) {
Expand Down

0 comments on commit f1cec44

Please sign in to comment.