This commit is contained in:
2025-09-09 14:43:04 +08:00
parent c191002cc6
commit 6ab8f89770
14 changed files with 722 additions and 1731 deletions
+6 -23
View File
@@ -155,38 +155,21 @@ export const saveProfileData = (profileData) => {
/**
* 清理登录流程中的临时数据
* @deprecated 使用 http/utils/auth-helper.js 中的 clearTempLoginData 替代
*/
export const clearTempLoginData = () => {
// 清理临时数据,保留重要的用户信息
uni.removeStorageSync(STORAGE_KEYS.WX_LOGIN_CODE)
console.log('清理临时登录数据')
const { clearTempLoginData } = require('../http/utils/auth-helper.js')
clearTempLoginData()
}
/**
* 检查并验证token有效性
* @returns {Promise<boolean>} token是否有效
* @deprecated 使用 http/utils/auth-helper.js 中的 validateToken 替代
*/
export const validateToken = async () => {
const token = uni.getStorageSync(STORAGE_KEYS.TOKEN)
if (!token) {
return false
}
try {
// 调用一个简单的API来验证token
const { getUserInfo } = await import('@/http/api/profile.js')
await getUserInfo({
custom: {
loading: false,
toast: false
}
})
return true
} catch (error) {
console.log('Token验证失败:', error)
return false
}
const { validateToken } = await import('../http/utils/auth-helper.js')
return await validateToken()
}
/**