feat(User): Add Logout

main
Flycro 2023-11-10 15:51:47 +01:00
parent 470efe6956
commit 5892921a7c
3 changed files with 28 additions and 1 deletions

View File

@ -23,7 +23,7 @@ const links = [{
<template #right>
<UColorModeButton />
<UButton to="#" target="_blank" icon="i-heroicons-user-solid" color="gray" variant="ghost" />
<UserDropdown />
</template>
<template #panel>

View File

@ -0,0 +1,22 @@
<script setup lang="ts">
const links = [{
label: 'Logout',
to: '/logout',
icon: 'i-heroicons-arrow-left-on-rectangle',
}]
</script>
<template>
<UPopover>
<UButton icon="i-heroicons-user-solid" color="gray" variant="ghost" />
<template #panel>
<div class="p-4">
<UNavigationLinks :links="links" />
</div>
</template>
</UPopover>
</template>
<style scoped>
</style>

5
pages/logout/index.vue Normal file
View File

@ -0,0 +1,5 @@
<script setup lang="ts">
definePageMeta({ middleware: ['auth'] })
const { logout } = useAuth()
logout()
</script>