feat: add issue reporting api endpoint

This commit is contained in:
thecodrr
2021-11-24 11:40:33 +05:00
parent aaf306f1aa
commit 5d198e9ea3
2 changed files with 17 additions and 0 deletions

View File

@@ -1,3 +1,5 @@
import hosts from "../utils/constants";
export default class Debug {
strip(item) {
return JSON.stringify({
@@ -16,4 +18,15 @@ export default class Debug {
additionalData: item.additionalData,
});
}
async report(title, body) {
const response = await fetch(`${hosts.ISSUES_HOST}/create/notesnook`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ title, body }),
});
if (!response.ok) return;
const json = await response.json();
return json.url;
}
}