2025-08-12 15:38:25 +08:00
|
|
|
uni.addInterceptor({
|
2025-08-13 11:05:40 +08:00
|
|
|
returnValue(res) {
|
|
|
|
|
if (
|
|
|
|
|
!(
|
|
|
|
|
!!res &&
|
|
|
|
|
(typeof res === 'object' || typeof res === 'function') &&
|
|
|
|
|
typeof res.then === 'function'
|
|
|
|
|
)
|
|
|
|
|
) {
|
|
|
|
|
return res
|
2025-08-12 15:38:25 +08:00
|
|
|
}
|
|
|
|
|
return new Promise((resolve, reject) => {
|
2025-08-13 11:05:40 +08:00
|
|
|
res.then(res => {
|
|
|
|
|
if (!res) return resolve(res)
|
2025-08-12 15:38:25 +08:00
|
|
|
return res[0] ? reject(res[0]) : resolve(res[1])
|
2025-08-13 11:05:40 +08:00
|
|
|
})
|
|
|
|
|
})
|
2025-08-12 15:38:25 +08:00
|
|
|
},
|
2025-08-13 11:05:40 +08:00
|
|
|
})
|