bugfix:未登录循环注册
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { request } from '../../utils/request'
|
||||
import { request, redirectToLogin } from '../../utils/request'
|
||||
import * as auth from '../../utils/auth'
|
||||
import { HoroscopeData } from '../../types/models'
|
||||
|
||||
const COLOR_MAP: Record<string, string> = {
|
||||
@@ -25,6 +26,11 @@ Page({
|
||||
|
||||
onShow() {
|
||||
this.syncTabBar()
|
||||
// 未登录直接回登录页(幂等跳转),不再发出必然 401 的请求
|
||||
if (!auth.isLoggedIn()) {
|
||||
redirectToLogin()
|
||||
return
|
||||
}
|
||||
if (!this.data.horoscope) this.fetchHoroscope(0)
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user