From 139f16b06d452c389c584f87f29d887ceaf868d8 Mon Sep 17 00:00:00 2001 From: Southpaw Date: Fri, 11 Aug 2023 13:58:12 +0100 Subject: [PATCH] Respones from Ghost is now a bit more efficient or something --- src/methods/publishPost.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/methods/publishPost.ts b/src/methods/publishPost.ts index d6a8909..1080c05 100644 --- a/src/methods/publishPost.ts +++ b/src/methods/publishPost.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-var-requires */ import { SettingsProp, ContentProp, DataProp } from "./../types/index"; -import { MarkdownView, Notice, request } from "obsidian"; +import { MarkdownView, Notice, requestUrl } from "obsidian"; import { sign } from "jsonwebtoken"; const matter = require("gray-matter"); @@ -48,7 +48,7 @@ export const publishPost = async ( feature_image: metaMatter?.feature_image || undefined, }; - const result = await request({ + const result = await requestUrl({ url: `${settings.url}/ghost/api/${version}/admin/posts/?source=html`, method: "POST", contentType: "application/json", @@ -60,7 +60,7 @@ export const publishPost = async ( body: JSON.stringify(contentPost(frontmatter, data)), }); - const json = JSON.parse(result); + const json = result.json; if (json?.posts) { new Notice(