开发:使用新的错误跟踪机器人

pull/1193/head
ChenX 4 years ago
parent b03e254247
commit 1aa9f82d30

@ -50,13 +50,19 @@ export async function ReportError(stack: any, msg: string = "未捕获的错误!
let userName = localStorage.getItem(StoreageKeys.UserName); let userName = localStorage.getItem(StoreageKeys.UserName);
let userPhone = localStorage.getItem(StoreageKeys.UserPhone); let userPhone = localStorage.getItem(StoreageKeys.UserPhone);
await PostData("https://cf.qcad.cc:25100/monitoring", { await fetch("http://cf.qcad.cc:25111/logs/error", {
stack, method: 'POST',
href: window.location.href, body: JSON.stringify({
path: window.location.pathname, stack,
user: userName, href: window.location.href,
msg: msg + "\n" + browserMsg, path: window.location.pathname,
phone: userPhone user: userName,
msg: msg + "\n" + browserMsg,
phone: userPhone
}),
headers: {
'content-type': 'application/json'
},
}); });
console.log("上报成功"); console.log("上报成功");
} }
@ -65,19 +71,3 @@ export async function ReportError(stack: any, msg: string = "未捕获的错误!
console.log("上报失败", error); console.log("上报失败", error);
} }
} }
export async function PostData(url: RequestInfo, data: {})
{
return fetch(url, {
body: JSON.stringify(data),
cache: 'no-cache',
credentials: 'include',
headers: {
'content-type': 'application/json'
},
method: 'POST',
mode: 'cors',
redirect: 'follow',
referrer: 'no-referrer',
});
}

Loading…
Cancel
Save