From 20de7c5202c97fa6255c6380b8b335118bbfc005 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ole=20Volds=C3=A6ter?= <ole.voldsater@uib.no>
Date: Thu, 10 Sep 2020 11:00:57 +0200
Subject: [PATCH] =?UTF-8?q?mer=20robust=20h=C3=A5ndtering=20av=20manglende?=
 =?UTF-8?q?=20artikkelelementer,=20sender=20api-n=C3=B8kkel?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/App.vue                | 7 +++++++
 src/components/Article.vue | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/App.vue b/src/App.vue
index 55dd0fa..480bc89 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -59,6 +59,13 @@ import '@trevoreyre/autocomplete-vue/dist/style.css'
 
 var api_endpoint = 'https://ordbok-dev.aws.uib.no/cache/article'
 
+axios.interceptors.request.use(function (config) {
+    config.headers["x-api-key"] = "ZkYiyRVXxH86ijsvhx3cH4SY5Iik2ijI3BKVJGMm"
+    return config;
+  }, function (error) {
+    return Promise.reject(error);
+  });
+
 window.onpopstate = function (event) {
   if (event.state) {
     app.__vue__._data.article = event.state.article
diff --git a/src/components/Article.vue b/src/components/Article.vue
index f04d668..962b7e7 100644
--- a/src/components/Article.vue
+++ b/src/components/Article.vue
@@ -1,13 +1,13 @@
 <template>
   <article v-show="article.lemmas.length">
     <Header :lemmas="article.lemmas" />
-    <section v-if="article.body.pronunciation.length">
+    <section v-if="article.body.pronunciation && article.body.pronunciation.length">
       <h3>Uttale</h3>
         <ul>
           <DefElement v-for="(element, index) in article.body.pronunciation" :key="index" :body='element' @article-click="article_link_click" />
         </ul>
     </section>
-    <section v-if="article.body.etymology">
+    <section v-if="article.body.etymology && article.body.etymology.length">
       <h3>Etymologi</h3>
         <ul>
           <DefElement v-for="(element, index) in article.body.etymology" :key="index" :body='element' @article-click="article_link_click" />
-- 
GitLab