mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-15 04:45:45 +01:00
12 lines
510 B
JavaScript
12 lines
510 B
JavaScript
export function report(msg, error, link, lineNo, columnNo) {
|
|
if (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(() => {});
|
|
}
|