Skip to content
Snippets Groups Projects
Commit 18fcb49b authored by Titus Netland's avatar Titus Netland
Browse files

Merge branch 'logout_in_profile' into 'main'

Added logout functionality

See merge request !38
parents 12c148de 9ab7f520
No related branches found
No related tags found
1 merge request!38Added logout functionality
Pipeline #176920 passed
...@@ -49,6 +49,13 @@ ...@@ -49,6 +49,13 @@
>Leiehistorikk</router-link >Leiehistorikk</router-link
> >
</li> </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> <li>
<router-link <router-link
to="/newPassword" to="/newPassword"
...@@ -118,7 +125,7 @@ export default { ...@@ -118,7 +125,7 @@ export default {
this.currentUser = await parseCurrentUser(); this.currentUser = await parseCurrentUser();
this.id = await this.$router.currentRoute.value.params.id; 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.isCurrentUser = true;
this.user = this.currentUser; this.user = this.currentUser;
return; return;
...@@ -131,11 +138,15 @@ export default { ...@@ -131,11 +138,15 @@ export default {
} }
}, },
getProfilePicture() { getProfilePicture() {
if (this.user.picture != "") { if (this.user.picture !== "") {
return this.user.picture; return this.user.picture;
} }
return "../assets/defaultUserProfileImage.jpg"; return "../assets/defaultUserProfileImage.jpg";
}, },
logout(){
this.$store.commit('logout');
this.$router.push('/')
}
}, },
beforeMount() { beforeMount() {
this.getUser(); this.getUser();
......
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