optimize(projects): modify the injection location of the token.

This commit is contained in:
Azir-11
2026-02-10 20:19:25 +08:00
committed by Soybean
parent b520db3ef4
commit 9d48ca5f1c

View File

@@ -19,7 +19,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
const { toLogin, redirectFromLogin } = useRouterPush(false);
const { loading: loginLoading, startLoading, endLoading } = useLoading();
const token = ref(getToken());
const token = ref('');
const userInfo: Api.Auth.UserInfo = reactive({
userId: '',
@@ -159,9 +159,10 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
}
async function initUserInfo() {
const hasToken = getToken();
const maybeToken = getToken();
if (hasToken) {
if (maybeToken) {
token.value = maybeToken;
const pass = await getUserInfo();
if (!pass) {