修改http请求的时候触发了登录超时不进行页面跳转,改为页面路由为主
This commit is contained in:
@ -64,7 +64,9 @@ const alovaInstance = createAlova({
|
|||||||
const token = uni.getStorageSync('token')
|
const token = uni.getStorageSync('token')
|
||||||
if (!token) {
|
if (!token) {
|
||||||
toast.info('请先登录')
|
toast.info('请先登录')
|
||||||
router.navigateTo(import.meta.env.VITE_LOGIN_URL, 500)
|
useUserStore().removeUserInfo()
|
||||||
|
uni.$emit('clearUser')
|
||||||
|
// router.navigateTo(import.meta.env.VITE_LOGIN_URL, 500)
|
||||||
throw new Error('[请求错误]:未登录')
|
throw new Error('[请求错误]:未登录')
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +102,7 @@ const alovaInstance = createAlova({
|
|||||||
|
|
||||||
if (config.meta?.toast !== false) {
|
if (config.meta?.toast !== false) {
|
||||||
toast.info(msg)
|
toast.info(msg)
|
||||||
router.navigateTo(import.meta.env.VITE_LOGIN_URL, 1000)
|
// router.navigateTo(import.meta.env.VITE_LOGIN_URL, 1000)
|
||||||
}
|
}
|
||||||
throw new Error(`登录超时[${code}]:${msg}`)
|
throw new Error(`登录超时[${code}]:${msg}`)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user