Skip to content

Commit 9d48ca5

Browse files
Azir-11honghuangdc
authored andcommitted
optimize(projects): modify the injection location of the token.
1 parent b520db3 commit 9d48ca5

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/store/modules/auth/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
1919
const { toLogin, redirectFromLogin } = useRouterPush(false);
2020
const { loading: loginLoading, startLoading, endLoading } = useLoading();
2121

22-
const token = ref(getToken());
22+
const token = ref('');
2323

2424
const userInfo: Api.Auth.UserInfo = reactive({
2525
userId: '',
@@ -159,9 +159,10 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
159159
}
160160

161161
async function initUserInfo() {
162-
const hasToken = getToken();
162+
const maybeToken = getToken();
163163

164-
if (hasToken) {
164+
if (maybeToken) {
165+
token.value = maybeToken;
165166
const pass = await getUserInfo();
166167

167168
if (!pass) {

0 commit comments

Comments
 (0)