From 2ee1fd444a3ba89f7d82f26bd2725dc5f4911280 Mon Sep 17 00:00:00 2001
From: ingrid <ingrimeg@stud.ntnu.no>
Date: Thu, 27 Apr 2023 07:20:32 +0200
Subject: [PATCH] =?UTF-8?q?man=20logges=20ut=20p=C3=A5=20login=20siden.=20?=
 =?UTF-8?q?dersom=20man=20ikke=20er=20logget=20inn,=20vises=20ikke=20navba?=
 =?UTF-8?q?r?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/components/EditProfile.vue | 3 ++-
 src/components/Navbar.vue      | 8 ++++++--
 src/views/LoginView.vue        | 4 ++++
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/components/EditProfile.vue b/src/components/EditProfile.vue
index aef56df..c98dcbc 100644
--- a/src/components/EditProfile.vue
+++ b/src/components/EditProfile.vue
@@ -78,7 +78,8 @@ export default {
             const id = this.profile.id;
 
             const numOfProfiles = API.getProfiles().length
-            if(numOfProfiles===1 && this.updatedProfile.upRestricted===true){
+            console.log("antall profiler: " + numOfProfiles) //todo
+            if(numOfProfiles===1 && this.updatedProfile.upRestricted==true){
               alert("Du må ha minst en standardprofil per konto. (ingen endringer er gjort)")
             }
             else {
diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue
index b981828..f220c31 100644
--- a/src/components/Navbar.vue
+++ b/src/components/Navbar.vue
@@ -1,6 +1,6 @@
 <template>
     <div>
-        <nav>
+        <nav v-if="isLoggedIn">
             <ul :aria-label = "'Navigation links'">
                 <li>
                     <RouterLink :to="'/'" :aria-label="'link to home page'">
@@ -36,6 +36,7 @@
 <script>
 import { Icon } from '@iconify/vue';
 import Logo from "@/components/Logo.vue";
+import {useAuthStore} from "@/stores/authStore";
 
 export default {
     name: "Navbar",
@@ -49,7 +50,10 @@ export default {
     },
     logoSize() {
       return '52px';
-    }
+    },
+      isLoggedIn(){
+        return useAuthStore().isLoggedIn;
+      }
   }
 }
 </script>
diff --git a/src/views/LoginView.vue b/src/views/LoginView.vue
index fe18b47..7761897 100644
--- a/src/views/LoginView.vue
+++ b/src/views/LoginView.vue
@@ -1,6 +1,7 @@
 <script>
   import { API } from '@/util/API.js';
   import router from '@/router/index.js';
+  import {useAuthStore} from "@/stores/authStore";
 
   export default {
     data() {
@@ -11,6 +12,9 @@
             errormsg: "",
         }
     },
+      created(){
+        useAuthStore().logout();
+      },
     methods: {
       login() {
         //todo: implement when API is up
-- 
GitLab