调试接口

This commit is contained in:
wangxiaowei
2025-12-22 04:48:05 +08:00
parent 24b7f61c98
commit ca0d16cf05
41 changed files with 750 additions and 345 deletions

View File

@ -49,7 +49,7 @@ const alovaInstance = createAlova({
statesHook: VueHook,
beforeRequest: onAuthRequired((method) => {
console.log("🚀 ~ method:", method)
// console.log("🚀 ~ method:", method)
// 设置默认 Content-Type
method.config.headers = {
ContentType: ContentTypeEnum.JSON,
@ -69,9 +69,10 @@ const alovaInstance = createAlova({
// method.config.headers.token = token;
const token = uni.getStorageSync('token')
console.log("🚀 ~ token=auth:", token)
if (!token) {
toast.info('请先登录')
router.switchTab('/pages/my/my', 500)
router.navigateTo(import.meta.env.VITE_LOGIN_URL, 500)
throw new Error('[请求错误]:未登录')
}
@ -115,7 +116,7 @@ const alovaInstance = createAlova({
if (config.meta?.toast !== false) {
toast.info(msg)
router.switchTab('/pages/my/my', 1000)
router.navigateTo(import.meta.env.VITE_LOGIN_URL, 1000)
}
throw new Error(`登录超时[${code}]${msg}`)
}