refactor(utils): 增加全局提示忽略白名单
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-03-15 17:12:07 +08:00
parent aef52631e7
commit 2646d025f4
4 changed files with 10 additions and 9 deletions

View File

@@ -10,6 +10,9 @@ interface Res<T> {
type Method = "GET" | "POST" | "PUT" | "DELETE";
// 忽略系统提示白名单
const IGNORED_TIPS = ["/user/find/phone"];
const request = (
url: string,
data: object = {},
@@ -26,10 +29,12 @@ const request = (
},
success: ({ data }) => {
if (data.code !== 200) {
Taro.showToast({
title: data.msg,
icon: "none",
});
if (!IGNORED_TIPS.includes(url)) {
Taro.showToast({
title: data.msg,
icon: "none",
});
}
reject(data);
} else {
resolve(data);