Files
uni-preset-vue/template/default/uni.promisify.adaptor.js
2025-11-12 16:51:56 +08:00

13 lines
364 B
JavaScript

uni.addInterceptor({
returnValue (res) {
if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) {
return res;
}
return new Promise((resolve, reject) => {
if (!res) {
return resolve(res)
}
res.then((res) => res[0] ? reject(res[0]) : resolve(res[1]));
});
},
});