mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2026-02-11 18:31:22 +08:00
optimize(projects): modify the injection location of the token.
This commit is contained in:
@@ -19,7 +19,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
|||||||
const { toLogin, redirectFromLogin } = useRouterPush(false);
|
const { toLogin, redirectFromLogin } = useRouterPush(false);
|
||||||
const { loading: loginLoading, startLoading, endLoading } = useLoading();
|
const { loading: loginLoading, startLoading, endLoading } = useLoading();
|
||||||
|
|
||||||
const token = ref(getToken());
|
const token = ref('');
|
||||||
|
|
||||||
const userInfo: Api.Auth.UserInfo = reactive({
|
const userInfo: Api.Auth.UserInfo = reactive({
|
||||||
userId: '',
|
userId: '',
|
||||||
@@ -159,9 +159,10 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function initUserInfo() {
|
async function initUserInfo() {
|
||||||
const hasToken = getToken();
|
const maybeToken = getToken();
|
||||||
|
|
||||||
if (hasToken) {
|
if (maybeToken) {
|
||||||
|
token.value = maybeToken;
|
||||||
const pass = await getUserInfo();
|
const pass = await getUserInfo();
|
||||||
|
|
||||||
if (!pass) {
|
if (!pass) {
|
||||||
|
|||||||
Reference in New Issue
Block a user