🐛 Fix authorization

This commit is contained in:
2025-09-26 01:11:58 +08:00
parent 0c36ff1bcd
commit 5c5b35b1b5
4 changed files with 32 additions and 6 deletions

View File

@@ -11,7 +11,7 @@ export const useUserStore = defineStore("user", () => {
const error = ref<string | null>(null)
// The name is match with the remote one (set by server Set-Cookie)
const token = useCookie<string | null>("AuthToken", {
const token = useCookie<string | null>("fl_AuthToken", {
default: () => null,
path: "/",
maxAge: 60 * 60 * 24 * 365 * 10
@@ -20,9 +20,6 @@ export const useUserStore = defineStore("user", () => {
// Getters
const isAuthenticated = computed(() => !!user.value && !!token.value)
// Call fetchUser immediately
fetchUser()
// Actions
async function fetchUser(reload = true) {
if (!reload && user.value) return // Skip fetching if already loaded and not forced to