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

add error logging

parent 7bced9ac
No related branches found
No related tags found
No related merge requests found
...@@ -111,6 +111,7 @@ function navigate_to_article(self, source) { ...@@ -111,6 +111,7 @@ function navigate_to_article(self, source) {
self.error = null self.error = null
}) })
.catch(function(error){ .catch(function(error){
console.log(error)
if (error.response && error.response.status == 404) { if (error.response && error.response.status == 404) {
self.error = ["Vi har ingen artikkel med id " + self.$route.params.id] self.error = ["Vi har ingen artikkel med id " + self.$route.params.id]
} else { } else {
...@@ -202,13 +203,10 @@ function load_articles(self, query, offset, n, dict) { ...@@ -202,13 +203,10 @@ function load_articles(self, query, offset, n, dict) {
self.error = null self.error = null
} }
if (offset == 0) { if (offset == 0) {
console.log("REPLACING")
self.search_results[dict] = results self.search_results[dict] = results
} }
else { else {
console.log("APPENDING")
self.search_results[dict] = self.search_results[dict].concat(results) self.search_results[dict] = self.search_results[dict].concat(results)
console.log(self.search_results)
} }
}) })
.catch(error => { .catch(error => {
...@@ -248,11 +246,8 @@ function navigate_to_query(self, word) { ...@@ -248,11 +246,8 @@ function navigate_to_query(self, word) {
}) })
}).catch(error =>{ }).catch(error =>{
console.log(error)
self.waiting_for_articles = false self.waiting_for_articles = false
self.connection_error(error) self.connection_error(error)
}) })
} }
...@@ -306,6 +301,7 @@ export default { ...@@ -306,6 +301,7 @@ export default {
}, },
connection_error: function(error) { connection_error: function(error) {
console.log(error)
this.search_results = {} this.search_results = {}
if (error.response) { if (error.response) {
this.error = [] this.error = []
...@@ -409,7 +405,8 @@ export default { ...@@ -409,7 +405,8 @@ export default {
axios.get(ARTICLE_ENDPOINT + 'nn/article/78569.json').then(function(response){ axios.get(ARTICLE_ENDPOINT + 'nn/article/78569.json').then(function(response){
self.monthly_nn = Object.assign(response.data, {dictionary: 'nn'}) self.monthly_nn = Object.assign(response.data, {dictionary: 'nn'})
}) })
}).catch(function(_){ }).catch(function(error){
console.log(error)
self.error = [] self.error = []
if (self.lang !== 'bm') self.error.push(`Eit nettverksproblem hindra lasting av sida. Prøv å laste sida på nytt`) if (self.lang !== 'bm') self.error.push(`Eit nettverksproblem hindra lasting av sida. Prøv å laste sida på nytt`)
if (self.lang !== 'nn') self.error.push(`Et nettverksproblem hindret lasting av siden. Prøv å laste siden på nytt`) if (self.lang !== 'nn') self.error.push(`Et nettverksproblem hindret lasting av siden. Prøv å laste siden på nytt`)
...@@ -429,11 +426,7 @@ export default { ...@@ -429,11 +426,7 @@ export default {
} }
window.onscroll = () => { window.onscroll = () => {
console.log(document.body.scrollHeight - window.window.innerHeight)
console.log("yof, max",window.pageYOffset, this.max_scroll)
if (window.pageYOffset > this.max_scroll && window.pageYOffset > window.window.innerHeight) { if (window.pageYOffset > this.max_scroll && window.pageYOffset > window.window.innerHeight) {
this.max_scroll = document.body.scrollHeight - window.window.innerHeight-1
console.log("MAX", this.max_scroll)
this.max_scroll += window.window.innerHeight this.max_scroll += window.window.innerHeight
if (this.max_scroll > document.body.scrollHeight - window.window.innerHeight-1) { if (this.max_scroll > document.body.scrollHeight - window.window.innerHeight-1) {
...@@ -443,15 +436,12 @@ export default { ...@@ -443,15 +436,12 @@ export default {
let offset = 10 * this.page let offset = 10 * this.page
this.page += 1 this.page += 1
if (!self.waiting_for_articles) { if (!self.waiting_for_articles) {
self.waiting_for_articles = true self.waiting_for_articles = true
console.log("PARAMS", this.query.q, offset, 10)
Promise.all([ Promise.all([
load_articles(this, this.query, offset, 10, "bm"), load_articles(this, this.query, offset, 10, "bm"),
load_articles(this, this.query, offset, 10, "nn") load_articles(this, this.query, offset, 10, "nn")
]).then(() => { ]).then(() => {
console.log("SUCCESS")
self.waiting_for_articles = false self.waiting_for_articles = false
}) })
} }
} }
......
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