From 389db9dd28c7798d0885dec96e2218dcb04e3c7a Mon Sep 17 00:00:00 2001
From: Trirst <abeces968@gmail.com>
Date: Tue, 12 Oct 2021 23:10:11 +0700
Subject: [PATCH] Add log out button

---
 src/components/UserAuthentication.vue | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/components/UserAuthentication.vue b/src/components/UserAuthentication.vue
index b133aa8..3ced8f1 100644
--- a/src/components/UserAuthentication.vue
+++ b/src/components/UserAuthentication.vue
@@ -53,7 +53,8 @@
       </div>
     </div>
     <div v-else class="text-lg ml-1 mb-1">
-      Welcome, {{ stateUser.username }}
+      <span>Welcome, {{ stateUser.username }}</span>
+      <button @click="logOut" class="ml-2 font-bold">Log out</button>
     </div>
   </div>
 </template>
@@ -101,6 +102,14 @@ export default {
         (error) => console.error("Something went terribly wrong... ", error);
       }
     },
+    logOut() {
+      this.saveStateUser({
+        id: null,
+        privileged: null,
+        username: null,
+        secret: null,
+      });
+    },
     ...mapActions(["saveStateUser"]),
   },
 };
-- 
GitLab