Remove unused files and code: - Delete test/debug endpoints (test.get.ts, public.get.ts, user.get.ts, debug-config backup) - Remove unused OAuth wrapper (oauth-authentik.ts) - Clean up debug console.log statements - Simplify code comments Fix TypeScript errors: - Add @types/node dependency - Create index.d.ts with User interface extension - Fix UButton color props (red→error, gray→neutral) - Add type assertions in protected.get.ts Update documentation: - Enhance README.md as template documentation - Update SETUP.md with correct API routes (/api/auth/* instead of /auth/*) - Add NUXT_OAUTH_AUTHENTIK_SERVER_URL_INTERNAL documentation - Update endpoint documentation This commit prepares the repository to be used as a template for future Nuxt 4 + Authentik OAuth projects.
49 lines
969 B
Vue
49 lines
969 B
Vue
<script setup lang="ts">
|
|
const { loggedIn, user, clear } = useUserSession()
|
|
|
|
const logout = async () => {
|
|
await clear()
|
|
window.location.href = '/api/auth/logout'
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div class="user-menu">
|
|
<div v-if="loggedIn" class="flex items-center gap-4">
|
|
<div class="flex items-center gap-2">
|
|
<UAvatar
|
|
v-if="user?.picture"
|
|
:src="user.picture"
|
|
:alt="user.name"
|
|
size="sm"
|
|
/>
|
|
<UAvatar
|
|
v-else
|
|
:text="user?.name?.charAt(0)"
|
|
size="sm"
|
|
/>
|
|
<span class="text-sm font-medium">{{ user?.name }}</span>
|
|
</div>
|
|
|
|
<UButton
|
|
color="error"
|
|
variant="soft"
|
|
size="sm"
|
|
@click="logout"
|
|
>
|
|
Cerrar Sesión
|
|
</UButton>
|
|
</div>
|
|
|
|
<UButton
|
|
v-else
|
|
color="primary"
|
|
variant="solid"
|
|
size="sm"
|
|
to="/login"
|
|
>
|
|
Iniciar Sesión
|
|
</UButton>
|
|
</div>
|
|
</template>
|