feat: 引入路由拦截

This commit is contained in:
菲鸽
2024-03-27 17:20:05 +08:00
parent 4d60d69a2f
commit d6d1a7a7be
7 changed files with 248 additions and 50 deletions

View File

@@ -13,16 +13,19 @@ export const useUserStore = defineStore(
}
const clearUserInfo = () => {
userInfo.value = undefined
userInfo.value = { ...initState }
}
// 一般没有reset需求不需要的可以删除
const reset = () => {
userInfo.value = { ...initState }
}
const isLogined = computed(() => !!userInfo.value.token)
return {
userInfo,
setUserInfo,
clearUserInfo,
isLogined,
reset,
}
},