Clean Canvas and resolve bug
This commit is contained in:
@@ -6,7 +6,9 @@
|
||||
{{ 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-outlined">Logout</button>
|
||||
<!-- <button @click="auth.logout()" class="p-button p-button-outlined">Logout</button> -->
|
||||
<button @click="logout()" class="p-button p-button-outlined">Logout</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -16,14 +18,26 @@
|
||||
import { useAuth } from '@websanova/vue-auth/src/v3.js';
|
||||
import { computed } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { ScenarioStore } from '@/stores/ScenarioStore';
|
||||
|
||||
|
||||
const auth = useAuth();
|
||||
const user = computed(() => auth.user());
|
||||
const router = useRouter();
|
||||
const scenario_store = ScenarioStore();
|
||||
|
||||
|
||||
function redirectProject() {
|
||||
router.push('/projects'); // Specifica il percorso per la pagina "Projects"
|
||||
}
|
||||
|
||||
function logout() {
|
||||
auth.logout().then(() => {
|
||||
scenario_store.resetStore();
|
||||
router.push('/auth/login');
|
||||
}).catch(err => {
|
||||
console.error("Errore durante il logout:", err);
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user