feat: send userId with github bug report

This commit is contained in:
thecodrr
2021-12-02 12:44:59 +05:00
parent 2cc5ec74c2
commit a3e95e50e0

View File

@@ -19,11 +19,23 @@ export default class Debug {
});
}
async report(title, body) {
/**
*
* @param {{
* title: string,
* body: string,
* userId: string
* }} reportData
* @returns {string} link to the github issue
*/
async report(reportData) {
if (!reportData) return;
const { title, body, userId } = reportData;
const response = await fetch(`${hosts.ISSUES_HOST}/create/notesnook`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ title, body }),
body: JSON.stringify({ title, body, userId }),
});
if (!response.ok) return;
const json = await response.json();