Files
consumocuidado/components/NavBarEditarUser.vue
2025-08-27 10:55:25 +02:00

55 lines
1.0 KiB
Vue

<template>
<div class="navsearch_container container-fluid">
<NuxtLink to="/editar/perfil">Mi perfil</NuxtLink>
<NuxtLink to="/" @click="handleLogout" >Cerrar sesión</NuxtLink>
</div>
</template>
<script>
import { useAuthStore } from '@/stores/auth'
import { mapActions } from 'pinia'
export default {
setup() {
const auth = useAuthStore();
return {
auth,
}
},
methods: {
...mapActions(useAuthStore, ['logout']),
async handleLogout() {
try {
await this.logout()
this.$router.push('/')
} catch (error) {
console.error('Error logging out:', error)
}
},
},
}
</script>
<style lang="scss" scoped>
.navsearch_container {
border-bottom: 3px solid $color-grey-nav;
text-align: center;
padding: 20px 20px;
a {
font-size: $m;
font-weight: $bold;
color: $color-navy;
text-decoration: none;
}
a:nth-child(1):after {
color: $color-navy;
content: '\22EE';
margin: 0.5rem;
}
@include mobile {
display: none;
}
}
</style>