调整 token错误更新

This commit is contained in:
浅念
2026-05-08 13:28:09 +08:00
parent bdd6bd1066
commit 845dff1ef7
5 changed files with 30 additions and 20 deletions
+12 -2
View File
@@ -5,15 +5,25 @@
import {
version
} from './package.json'
import {
silentLogin
} from '@/utils/auth.js'
// #ifdef APP
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
// #endif
export default {
onLaunch: function() {
// 线上示例使用
// console.log('%c uni-app官方团队诚邀优秀前 端工程师加盟,一起打造更卓越的uni-app & uniCloud,欢迎投递简历到 hr2013@dcloud.io', 'color: red');
console.log('App Launch');
const token = uni.getStorageSync('token')
if (token) {
this.globalData.tokenRefreshPromise = silentLogin().then(result => {
if (!result.success) {
uni.removeStorageSync('token')
}
return result
})
}
},
onShow: function() {
console.log('App Show')