fix logout action
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<header class="header">
|
||||
<div class="container wrapper">
|
||||
<div class="navmenu-container">
|
||||
<NavMenu @logout="logout" />
|
||||
<NavMenu @handle-logout="handleLogout" />
|
||||
</div>
|
||||
<!-- isAdmin: {{ isAdmin }} <br>
|
||||
isAuthenticated: {{ isAuthenticated }} <br> -->
|
||||
@@ -71,7 +71,6 @@
|
||||
import { mapActions } from 'pinia'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
export default {
|
||||
|
||||
setup() {
|
||||
const auth = useAuthStore();
|
||||
return {
|
||||
@@ -89,10 +88,9 @@ export default {
|
||||
return this.auth.getName
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
...mapActions('auth', ['logout']),
|
||||
async logout() {
|
||||
...mapActions(useAuthStore, ['logout']),
|
||||
async handleLogout() {
|
||||
try {
|
||||
await this.logout()
|
||||
this.$router.push('/login')
|
||||
|
||||
Reference in New Issue
Block a user