调试重新进入比赛
This commit is contained in:
40
src/apis.js
40
src/apis.js
@@ -11,23 +11,26 @@ function request(method, url, data = {}) {
|
||||
},
|
||||
data,
|
||||
success: (res) => {
|
||||
if (res.data.code === 0) resolve(res.data.data);
|
||||
else {
|
||||
if (res.data.message.indexOf("登录身份已失效") !== -1) {
|
||||
uni.removeStorageSync("token");
|
||||
if (res.data) {
|
||||
const { code, data, message } = res.data;
|
||||
if (code === 0) resolve(data);
|
||||
else {
|
||||
if (message.indexOf("登录身份已失效") !== -1) {
|
||||
uni.removeStorageSync("token");
|
||||
}
|
||||
if (url.indexOf("/user/room") !== -1 && method === "GET") {
|
||||
resolve({});
|
||||
return;
|
||||
}
|
||||
if (message === "ERROR_BATTLE_GAMING") {
|
||||
resolve({});
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
if (url.indexOf("/user/room") !== -1 && method === "GET") {
|
||||
resolve({});
|
||||
return;
|
||||
}
|
||||
if (res.data.message === "ERROR_BATTLE_GAMING") {
|
||||
resolve({});
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title: res.data.message,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
@@ -277,3 +280,8 @@ export const isGamingAPI = async () => {
|
||||
const result = await request("GET", "/user/isGaming");
|
||||
return result.gaming || false;
|
||||
};
|
||||
|
||||
export const getCurrentGameAPI = async () => {
|
||||
const result = await request("GET", "/user/join/battle");
|
||||
return result.currentGame || {};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user