adding loggedIn to auth

This commit is contained in:
2025-12-10 04:43:18 +00:00
parent 0458e1ed09
commit f5bf580abb
11 changed files with 26 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
<template>
<nav class="no-print flex-row">
<RouterLink to="/"><h1>HOME</h1></RouterLink>
<RouterLink to="/"><p>HOME</p></RouterLink>
<!-- <RouterLink to="/cv"><h1>CV</h1></RouterLink> -->
</nav>
</template>
@@ -9,4 +9,7 @@
nav {
height: 10vh;
}
h1 {
height: 100%;
}
</style>

View File

@@ -5,7 +5,6 @@ import { useAuthStore } from "@/stores/auth";
const auth = useAuthStore();
const username = ref("");
const password = ref("");
const loggedIn = computed(() => !!auth.user.username);
function handleLogin() {
auth.createUser(username.value, password.value);
@@ -13,7 +12,7 @@ function handleLogin() {
</script>
<template>
<div v-if="loggedIn">
<div v-if="auth.loggedIn">
<h1>Logged in</h1>
<p>{{ auth.user.ID }}</p>
<p>{{ auth.user.username }}</p>

View File

@@ -5,7 +5,6 @@ import { useAuthStore } from "@/stores/auth";
const auth = useAuthStore();
const username = ref("");
const password = ref("");
const loggedIn = computed(() => !!auth.user.username);
function handleLogin() {
auth.logIn(username.value, password.value);
@@ -17,7 +16,7 @@ function handleLogout() {
</script>
<template>
<div v-if="loggedIn">
<div v-if="auth.loggedIn">
<h1>Logged in</h1>
<p>{{ auth.user.ID }}</p>
<p>{{ auth.user.username }}</p>