Files
notesnook/packages/core/api/debug.js

46 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-11-24 11:40:33 +05:00
import hosts from "../utils/constants";
export default class Debug {
strip(item) {
return JSON.stringify({
title: !!item.title,
description: !!item.description,
headline: !!item.headline,
colored: !!item.color,
type: item.type,
notebooks: item.notebooks,
tags: item.tags,
id: item.id,
contentId: item.contentId,
2021-12-20 14:37:06 +05:00
dateModified: item.dateModified,
dateEdited: item.dateEdited,
dateDeleted: item.dateDeleted,
dateCreated: item.dateCreated,
additionalData: item.additionalData,
});
}
2021-11-24 11:40:33 +05:00
/**
*
* @param {{
* title: string,
* body: string,
* userId: string
* }} reportData
* @returns {Promise<string>} link to the github issue
*/
async report(reportData) {
if (!reportData) return;
const { title, body, userId } = reportData;
2021-11-24 11:40:33 +05:00
const response = await fetch(`${hosts.ISSUES_HOST}/create/notesnook`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ title, body, userId }),
2021-11-24 11:40:33 +05:00
});
if (!response.ok) return;
const json = await response.json();
return json.url;
}
}