mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-10-30 01:26:43 +08:00
13 lines
539 B
JavaScript
13 lines
539 B
JavaScript
export function report(msg, error, link, lineNo, columnNo) {
|
|
if (window.navigator.onLine === false) return Promise.resolve();
|
|
let url = "/report?";
|
|
url += "url=" + encodeURIComponent(location.href) + "&";
|
|
url += "msg=" + encodeURIComponent(msg) + "&";
|
|
url += "from=" + encodeURIComponent(link) + "&";
|
|
url += "from.lineNo=" + lineNo + "&";
|
|
url += "from.columnNo=" + columnNo;
|
|
if (error) url += "error=" + encodeURIComponent(error.message) + "&";
|
|
|
|
return fetch(url, { method: "post" }).catch(() => {});
|
|
}
|