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

Refactor

parent c32b1d12
No related branches found
No related tags found
No related merge requests found
...@@ -226,7 +226,8 @@ export default { ...@@ -226,7 +226,8 @@ export default {
Promise.all(unwrapped.map((article) => { Promise.all(unwrapped.map((article) => {
return axios.get(`${api_endpoint}/${article.dictionary}/article/${article.id}`) return axios.get(`${api_endpoint}/${article.dictionary}/article/${article.id}`)
})).then((response) => { }))
.then((response) => {
self.search_results = response.map((element, index) => { self.search_results = response.map((element, index) => {
return Object.assign(element.data, {source: source, match: event.match, dictionary: unwrapped[index].dictionary}) return Object.assign(element.data, {source: source, match: event.match, dictionary: unwrapped[index].dictionary})
}) })
...@@ -234,7 +235,7 @@ export default { ...@@ -234,7 +235,7 @@ export default {
self.error = null self.error = null
}) })
.catch(function(error){ .catch(error => {
self.search_results = [] self.search_results = []
if (error.response) { if (error.response) {
self.error = "Noe gikk galt på serversiden" self.error = "Noe gikk galt på serversiden"
...@@ -242,7 +243,7 @@ export default { ...@@ -242,7 +243,7 @@ export default {
self.error = "Nettverksproblemer, prøv igjen" self.error = "Nettverksproblemer, prøv igjen"
} }
}) })
.then(function(){ .then(() => {
self.$plausible.trackEvent('dropdown selection', {props: {query: event.q, match: event.match}}) self.$plausible.trackEvent('dropdown selection', {props: {query: event.q, match: event.match}})
self.waiting_for_articles = false self.waiting_for_articles = false
history.replaceState({article: self.article, search_results: self.search_results, lang: self.lang, error: self.error}, '') history.replaceState({article: self.article, search_results: self.search_results, lang: self.lang, error: self.error}, '')
......
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