Login updated

This commit is contained in:
2026-03-12 15:30:19 +00:00
parent d898ae29ad
commit 3127ccbdbe
2 changed files with 43 additions and 6 deletions

View File

@@ -29,7 +29,7 @@
</v-btn>
<v-btn
v-if="!token"
v-if="!isLoggedIn"
to="/login"
variant="text"
class="nav-auth-btn ml-4"
@@ -58,11 +58,18 @@
<script setup>
import '@/assets/css/app-theme.css'
const isLoggedIn = useState('isLoggedIn', () => false)
const tokenCookie = useCookie('seasoned_token')
const token = useCookie('seasoned_token')
onMounted(() => {
if (tokenCookie.value) {
isLoggedIn.value = true
}
})
const logout = () => {
token.value = null
tokenCookie.value = null
isLoggedIn.value = false
if (import.meta.client) {
localStorage.removeItem('token')