Browse Source

Add logout button

pull/341/head
Hironsan 5 years ago
parent
commit
87d70157b1
1 changed files with 35 additions and 7 deletions
  1. 42
      frontend/components/organisms/layout/TheHeader.vue

42
frontend/components/organisms/layout/TheHeader.vue

@ -57,11 +57,37 @@
>
Sign in
</v-btn>
<v-menu
v-if="isAuthenticated"
bottom
>
<template v-slot:activator="{ on }">
<v-btn
icon
v-on="on"
>
<v-icon>mdi-dots-vertical</v-icon>
</v-btn>
</template>
<v-list>
<v-list-item @click="signout">
<v-list-item-icon>
<v-icon>mdi-logout</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>
Sign out
</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
</v-menu>
</v-app-bar>
</template>
<script>
import { mapGetters } from 'vuex'
import { mapGetters, mapActions } from 'vuex'
import TheColorModeSwitcher from '@/components/organisms/layout/TheColorModeSwitcher'
export default {
@ -82,12 +108,14 @@ export default {
computed: {
...mapGetters('auth', ['isAuthenticated'])
},
methods: {
...mapActions('auth', ['logout']),
signout() {
this.logout()
this.$router.push('/')
}
}
}
</script>
<style scoped>
.top{
text-decoration: none;
}
</style>
Loading…
Cancel
Save