fix token bug

This commit is contained in:
贾旖璇 2024-10-09 15:19:28 +08:00
parent fc24fe6e02
commit 27bb29b7a2

View File

@ -32,12 +32,14 @@ const request = new Request({
// response.config.headers["Authorization"] = response.data.data.Token; // response.config.headers["Authorization"] = response.data.data.Token;
// } // }
if (response.data.code === 401) { if (response.data.code === 401) {
const id = uni.getStorageSync("id",id); uni.clearStorageSync()
const pid = uni.getStorageSync("pid",pid); const params = new URLSearchParams(window.location.search)
console.log("id",id) const id = params.get('id')
const pid = params.get('pid')
uni.navigateTo({ uni.navigateTo({
url: "/pages/login/index?id=" + id + "&pid=" + pid, url: "/pages/login/index?id="+id+'&pid='+pid,
}); });
return false
} }
if ([200, 201, 204].includes(response.status)) { if ([200, 201, 204].includes(response.status)) {
return response.config.responseType === "blob" ? response : response; return response.config.responseType === "blob" ? response : response;