<template>
    <div class="config-panel hidden">
        <div class="config-panel-content">
            <span class="config-panel-label">Welcome </span>
            <span v-if="user">
                {{ user.name + " " + user.surname }}
            </span> 
            <!-- <button @click="redirectProject()" class="p-button p-button-outlined">Projects</button> -->
            <button @click="auth.logout()" class="p-button p-button-danger p-button-outlined">Logout</button>
        </div>
    </div>
</template>

<script setup>

import { useAuth } from '@websanova/vue-auth/src/v3.js';
import { computed } from 'vue';
import { useRouter } from 'vue-router';


const auth = useAuth();
const user = computed(() => auth.user());
const  router = useRouter();

function redirectProject() {
    router.push('/projects'); // Specifica il percorso per la pagina "Projects"
}

</script>
