调试接口

This commit is contained in:
wangxiaowei
2025-12-22 19:06:04 +08:00
parent ca0d16cf05
commit 90e9448b68
15 changed files with 220 additions and 152 deletions

View File

@ -49,7 +49,6 @@ const alovaInstance = createAlova({
statesHook: VueHook,
beforeRequest: onAuthRequired((method) => {
// console.log("🚀 ~ method:", method)
// 设置默认 Content-Type
method.config.headers = {
ContentType: ContentTypeEnum.JSON,
@ -59,7 +58,6 @@ const alovaInstance = createAlova({
const { config } = method
const ignoreAuth = !config.meta?.ignoreAuth
console.log('ignoreAuth===>', ignoreAuth)
// 处理认证信息 自行处理认证问题
if (ignoreAuth) {
// const token = 'getToken()'
@ -69,7 +67,6 @@ const alovaInstance = createAlova({
// method.config.headers.token = token;
const token = uni.getStorageSync('token')
console.log("🚀 ~ token=auth:", token)
if (!token) {
toast.info('请先登录')
router.navigateTo(import.meta.env.VITE_LOGIN_URL, 500)
@ -129,7 +126,7 @@ const alovaInstance = createAlova({
if (code !== ResultEnum.Success) {
if (config.meta?.toast !== false) {
toast.warning(msg)
toast.info(msg)
}
throw new Error(`请求错误[${code}]${msg}`)
}