game-village-politics-frontend/app/app.vue

37 lines
912 B
Vue
Raw Normal View History

<script setup lang="ts">
const { t } = useI18n()
const { user, logout } = useAuth()
const notices = useNotices()
const connection = computed(() =>
isMockServer ? t('app.mock') : ws.is_opened.value ? t('app.connected') : t('app.offline'),
)
useHead({ title: () => t('app.title') })
</script>
<template>
<div>
<header>
<strong>{{ t('app.title') }}</strong>
<template v-if="user">
· <NuxtLink to="/worlds">{{ t('app.worlds') }}</NuxtLink>
· {{ user.name }}
· <button type="button" @click="logout()">{{ t('app.logout') }}</button>
</template>
· <small>{{ connection }}</small>
</header>
<ul v-if="notices.list.value.length">
<li v-for="n in notices.list.value" :key="n.id" @click="notices.dismiss(n.id)">
[{{ n.type }}] {{ n.text }}
</li>
</ul>
<hr />
<main>
<NuxtPage />
</main>
</div>
</template>