退出登录清空数据修改
This commit is contained in:
@@ -59,7 +59,7 @@ function logout() {
|
|||||||
positiveText: '确定',
|
positiveText: '确定',
|
||||||
negativeText: '取消',
|
negativeText: '取消',
|
||||||
onPositiveClick: () => {
|
onPositiveClick: () => {
|
||||||
authStore.resetStore();
|
authStore.logout();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,12 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
|||||||
/** Is login */
|
/** Is login */
|
||||||
const isLogin = computed(() => Boolean(token.value));
|
const isLogin = computed(() => Boolean(token.value));
|
||||||
|
|
||||||
|
function logout() {
|
||||||
|
clearAuthStorage();
|
||||||
|
localStg.clear();
|
||||||
|
toLogin();
|
||||||
|
}
|
||||||
|
|
||||||
/** Reset auth store */
|
/** Reset auth store */
|
||||||
async function resetStore() {
|
async function resetStore() {
|
||||||
recordUserId();
|
recordUserId();
|
||||||
@@ -187,6 +193,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
|||||||
loginLoading,
|
loginLoading,
|
||||||
resetStore,
|
resetStore,
|
||||||
login,
|
login,
|
||||||
initUserInfo
|
initUserInfo,
|
||||||
|
logout
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user