feat: 调整优化登录的逻辑
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { goLogin } from "../../hooks/useGoLogin";
|
||||
import { BASE_URL } from "./baseUrl";
|
||||
import { goLogin } from "@/hooks/useGoLogin";
|
||||
import { loginAuth, checkPhone } from "@/manager/LoginManager";
|
||||
|
||||
const defaultConfig = {
|
||||
header: {
|
||||
@@ -50,10 +51,16 @@ function request(url, args = {}, method = "POST", customConfig = {}) {
|
||||
success: (res) => {
|
||||
console.log("请求响应:" + JSON.stringify(res));
|
||||
resolve(res.data);
|
||||
// if (res.statusCode && res.statusCode === 424) {
|
||||
// uni.setStorageSync("token", "");
|
||||
// goLogin();
|
||||
// }
|
||||
if (res.statusCode && res.statusCode === 424) {
|
||||
console.log("424错误,重新登录");
|
||||
loginAuth().then(async () => {
|
||||
// 检测是否绑定手机号
|
||||
const res = await checkPhone();
|
||||
if (!res.data) {
|
||||
goLogin();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error("请求失败:", err);
|
||||
|
||||
Reference in New Issue
Block a user