From 13ed94fbf4f2a4274b9b5ae7af230e6dfbeb5556 Mon Sep 17 00:00:00 2001 From: Yusuf Bouzekri Date: Mon, 25 Mar 2024 21:52:56 +0100 Subject: [PATCH] fix --- src/pages/api/micropub.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/api/micropub.ts b/src/pages/api/micropub.ts index bca371c..7d09ab1 100644 --- a/src/pages/api/micropub.ts +++ b/src/pages/api/micropub.ts @@ -38,6 +38,7 @@ export async function POST({ request, site, url }: APIContext) { const headerAuthToken = request.headers.get("Authorization")?.replace('Bearer ', '') const authToken = headerAuthToken || bodyAuthToken + console.log(authToken) if (!authToken) return Error(401, 'no token') @@ -51,7 +52,10 @@ export async function POST({ request, site, url }: APIContext) { const indieToken: IndieTokenResponse = await res.json() - if (hasOwnProperty(indieToken, 'me') && indieToken.me !== site?.toString()) { + if (hasOwnProperty(indieToken, 'me') && indieToken.me === site?.toString()) { + + // TODO: Create note here + return new Response(null, { statusText: "Created", status: 201, @@ -63,6 +67,5 @@ export async function POST({ request, site, url }: APIContext) { return Error(401, 'invalid token') } - // TODO: Create note here }