From 093f5af2eebf34584f9343cd368629adb7472f6d Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Mon, 16 Sep 2024 11:01:40 -0400 Subject: [PATCH] Support 'false' for draft --- src/pages/api/[...path].ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/api/[...path].ts b/src/pages/api/[...path].ts index cd9c686..6d32f90 100644 --- a/src/pages/api/[...path].ts +++ b/src/pages/api/[...path].ts @@ -26,7 +26,8 @@ const app = new Hono<{ Bindings: AstroContext }>() .post("/notes/:id", async (c) => { const id = c.req.param("id"); const props: Record = c.req.query(); - if (!props.draft && !props.homepage) { + const draft = props.draft ? props.draft === "true" : false; + if (!draft && !props.homepage) { let slug = props.slug || slugify(props.title); if (isULID(slug)) { throw new Error("Title or H1s should not be a ULID");