Skip to content
Snippets Groups Projects
Commit 526a28e7 authored by Henrik Askjer's avatar Henrik Askjer
Browse files

Move article id query to DictionaryView and include dict parameter

parent 7642c6c5
No related branches found
No related tags found
No related merge requests found
......@@ -64,26 +64,11 @@
},
select(item) {
if (item) {
this.items = []
if (typeof item != 'string') {
this.items = []
this.suggesting = false
if (item.match) {
let self = this
self.api.get('articles?', {params: {lord: item.match}}).then((response) => {
item.article_ids = response.data
self.submit(item)
})
} else {
console.log(item)
this.submit(item)
}
}
// If blurred
else {
this.items = []
this.submit(item)
}
}
}
......
......@@ -220,20 +220,21 @@ export default {
methods: {
select_result: function (event) {
this.event = event
if (event.article_ids) {
let source = '/' + this.lang + '/w/' + event.match
this.$router.push(source)
let unwrapped = []
for (const d in event.article_ids) {
if (d == this.lang || this.lang == "bob,nob") {
event.article_ids[d].forEach(i => unwrapped.push({
if (event.match) {
let self = this
oda_api.get('articles?', {params: {lord: event.match, dict: this.lang}}).then((response) => {
event.article_ids = response.data
let source = '/' + this.lang + '/w/' + event.match
this.$router.push(source)
let unwrapped = []
for (const d in event.article_ids) {
event.article_ids[d].forEach(i => unwrapped.push({
dictionary: d,
id: i
}))
}
}
let self = this
Promise.all(unwrapped.map((article) => {
return axios.get(`${oda_dev}/${article.dictionary}/article/${article.id}.json`)
......@@ -274,7 +275,7 @@ export default {
error: self.error
}, '')
})
} else {
})} else {
this.waiting_for_articles = true
this.article = null
this.$router.push(`/${this.lang}/search/${event.q}`)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment