feat: logout button for gamemasters/admins

This commit is contained in:
Settel 2022-03-15 07:32:24 +01:00
parent 4fe057f5d9
commit 908080cde6

View File

@ -7,6 +7,7 @@
<button @click="finishGame">Finish Game</button> <button @click="finishGame">Finish Game</button>
<button v-if="$route.path != '/play'" @click="go('/play')">switch to game</button> <button v-if="$route.path != '/play'" @click="go('/play')">switch to game</button>
<button v-if="$route.path != '/admin'" @click="go('/admin')">admin interface</button> <button v-if="$route.path != '/admin'" @click="go('/admin')">admin interface</button>
<button class="button-logout" @click="logout">logout</button>
</nav> </nav>
</template> </template>
@ -40,6 +41,11 @@ export default {
go(path) { go(path) {
this.$router.push({ path }) this.$router.push({ path })
}, },
async logout() {
this.authCode = ''
await this.$axios.$get('/api/logout')
this.go('/')
},
}, },
} }
</script> </script>
@ -56,5 +62,9 @@ export default {
padding: 0 1rem; padding: 0 1rem;
font-size: 18px; font-size: 18px;
} }
.button-logout {
float: right;
}
} }
</style> </style>