调试接口
This commit is contained in:
@ -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}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user