Files
project-manager/web/src/App.vue
T

39 lines
1.0 KiB
Vue
Raw Normal View History

<script setup lang="ts">
import { RouterLink, RouterView, useRouter } from 'vue-router'
import { useAuthStore } from './stores/auth'
import { useItemsStore } from './stores/items'
import { useListsStore } from './stores/lists'
const auth = useAuthStore()
const lists = useListsStore()
const items = useItemsStore()
const router = useRouter()
async function onLogout() {
auth.logout()
lists.reset()
items.reset()
await router.push({ name: 'login' })
}
</script>
<template>
<div class="app">
<header class="app__bar">
<span class="app__brand">Todo List</span>
<div v-if="auth.isAuthenticated" class="app__account">
<RouterLink v-if="!auth.emailVerified" to="/profile" class="badge badge--warn">
verify email
</RouterLink>
<RouterLink to="/profile" class="app__email">{{ auth.user?.email }}</RouterLink>
<button type="button" class="link" @click="onLogout">Log out</button>
</div>
</header>
<main class="app__main">
<RouterView />
</main>
</div>
</template>