Custom: use node-fetch to post notes rather than requestUrl for better debug

This commit is contained in:
2024-07-27 23:36:00 +01:00
parent b5ac42e6e3
commit e9c2b4aada
4 changed files with 202 additions and 165 deletions

View File

@@ -81,7 +81,7 @@ export async function uploadCommandGeneral(
const res = await upload.syncMarkdownToNotionGeneral(basename, cover, tags, markDownData, nowFile, this.app);
if (res.status === 200) {
new Notice(`${i18nConfig["sync-success"]}${basename}`).noticeEl.style.color = "green";
new Notice(`${i18nConfig["sync-preffix"]} ${basename} ${i18nConfig["sync-success"]}`).noticeEl.style.color = "green";
} else {
new Notice(`${i18nConfig["sync-fail"]}${basename}`, 5000);
}
@@ -114,8 +114,9 @@ export async function uploadCommandCustom(
const upload = new Upload2NotionCustom(plugin, dbDetails);
const res = await upload.syncMarkdownToNotionCustom(cover, customValues, markDownData, nowFile, this.app);
if (res.status === 200) {
new Notice(`${i18nConfig["sync-success"]}${basename}`).noticeEl.style.color = "green";
const { response } = res;
if (response.status === 200) {
new Notice(`${i18nConfig["sync-preffix"]} ${basename} ${i18nConfig["sync-success"]}`).noticeEl.style.color = "green";
} else {
new Notice(`${i18nConfig["sync-fail"]}${basename}`, 5000);
}