feat: 为兼容旧版本,保留 userPhone 字段并更新请求头中的 phone 字段

This commit is contained in:
傅光孟 2026-02-24 15:40:59 +08:00
parent 8e98e3d63a
commit 15e307dbea
2 changed files with 5 additions and 1 deletions

View File

@ -82,6 +82,10 @@ const storeSetup = () => {
});
setToken(result.data.token);
setUserInfos({ ...result.data });
// 为了兼容之前的版本,暂时保留 userPhone 字段
Session.set("userPhone", data.phone);
uni.showToast({
title: "登录成功",
icon: "success",

View File

@ -23,7 +23,7 @@ service.interceptors.request.use(
// 在发送请求之前做些什么 token
if (Session.get("token")) {
config.headers!["auth-token"] = `${Session.get("token")}`;
config.headers!["phone"] = `${Session.get("userInfos").phone}`;
config.headers!["phone"] = `${Session.get("userPhone")}`;
}
return config;
},