18 lines
493 B
TypeScript
18 lines
493 B
TypeScript
// app.ts
|
|
import * as auth from './utils/auth'
|
|
import { setAuthExpiredHandler } from './utils/request'
|
|
|
|
App<IAppOption>({
|
|
globalData: {},
|
|
|
|
onLaunch() {
|
|
// 登录失效 / 账号禁用时统一清登录态。
|
|
// 跳转登录页由 request.ts 的 redirectToLogin 单一入口负责(幂等去重),
|
|
// 避免多个请求同时 401 时并发 reLaunch 打断 webview 路由。
|
|
setAuthExpiredHandler(() => {
|
|
auth.clearTokens()
|
|
auth.clearUserInfo()
|
|
})
|
|
},
|
|
})
|