diff --git a/src/components/UserProfileComponents/LargeProfileCard.vue b/src/components/UserProfileComponents/LargeProfileCard.vue index 695ef260ac7df019805abe3f27cbeda6cc00f5b3..f8ec7c083c839b58825a4e0e5ac9e7222bc99b21 100644 --- a/src/components/UserProfileComponents/LargeProfileCard.vue +++ b/src/components/UserProfileComponents/LargeProfileCard.vue @@ -49,6 +49,13 @@ >Leiehistorikk</router-link > </li> + <li> + <div + @click="logout" + class="cursor-pointer block py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white" + >Logg ut + </div> + </li> <li> <router-link to="/newPassword" @@ -118,7 +125,7 @@ export default { this.currentUser = await parseCurrentUser(); this.id = await this.$router.currentRoute.value.params.id; - if (this.id == this.currentUser.accountId) { + if (this.id === this.currentUser.accountId) { this.isCurrentUser = true; this.user = this.currentUser; return; @@ -131,11 +138,15 @@ export default { } }, getProfilePicture() { - if (this.user.picture != "") { + if (this.user.picture !== "") { return this.user.picture; } return "../assets/defaultUserProfileImage.jpg"; }, + logout(){ + this.$store.commit('logout'); + this.$router.push('/') + } }, beforeMount() { this.getUser();