31 lines
788 B
Vue
31 lines
788 B
Vue
<script setup lang="ts">
|
|||
|
|
import { RouterView, useRouter } from 'vue-router'
|
||
|
|
import { useAuthStore } from './stores/auth'
|
||
|
|
|
||
|
|
const auth = useAuthStore()
|
||
|
|
const router = useRouter()
|
||
|
|
|
||
|
|
async function onLogout() {
|
||
|
|
auth.logout()
|
||
|
|
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">
|
||
|
|
<span class="app__email">{{ auth.user?.email }}</span>
|
||
|
|
<span v-if="!auth.emailVerified" class="badge badge--warn">email unverified</span>
|
||
|
|
<button type="button" class="link" @click="onLogout">Log out</button>
|
||
|
|
</div>
|
||
|
|
</header>
|
||
|
|
|
||
|
|
<main class="app__main">
|
||
|
|
<RouterView />
|
||
|
|
</main>
|
||
|
|
</div>
|
||
|
|
</template>
|