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,7 +1,12 @@
/* PRINTING */ /* PRINTING */
@media print { @media print {
.no-print { .no-print,
.no-print * {
display: none !important; display: none !important;
margin: 0px;
padding: 0px;
width: 0x;
height: 0px;
} }
} }
/* END OF PRINTING */ /* END OF PRINTING */
@@ -82,6 +87,7 @@ button {
/* END OF ELEMENTS */ /* END OF ELEMENTS */
/* CLASSES */ /* CLASSES */
.img-stamp { .img-stamp {
width: 99px; width: 99px;
height: 55px; height: 55px;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -5,7 +5,7 @@ import Footer from "@/components/Footer.vue";
</script> </script>
<template> <template>
<Navbar style="height: 5vh" /> <Navbar style="height: 5vh" class="no-print" />
<RouterView /> <RouterView />

View File

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

View File

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

View File

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

View File

@@ -6,6 +6,8 @@ export const useAuthStore = defineStore("auth", () => {
const user = ref({}); const user = ref({});
checkToken(); checkToken();
const loggedIn = computed(() => !!auth.user.username);
async function logOut() { async function logOut() {
try { try {
const res = await axios.post("/api/auth/logout"); const res = await axios.post("/api/auth/logout");
@@ -57,5 +59,13 @@ export const useAuthStore = defineStore("auth", () => {
} }
} }
return { user, checkToken, logIn, refreshToken, logOut, createUser }; return {
user,
checkToken,
logIn,
refreshToken,
logOut,
createUser,
loggedIn,
};
}); });

View File

@@ -11,7 +11,7 @@ import Watching from "@/components/home/Watching.vue";
</script> </script>
<template> <template>
<main class="center-content flex-col"> <main class="center-content flex-col bg-tile">
<div class="a4page-portrait bdr-1 grid"> <div class="a4page-portrait bdr-1 grid">
<Intro class="intro bdr-primary bg-primary" /> <Intro class="intro bdr-primary bg-primary" />
<Listening class="listening bdr-primary bg-primary" /> <Listening class="listening bdr-primary bg-primary" />