Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
spcbfr committed Mar 25, 2024
1 parent 967bd63 commit 13ed94f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/pages/api/micropub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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,
Expand All @@ -63,6 +67,5 @@ export async function POST({ request, site, url }: APIContext) {
return Error(401, 'invalid token')
}

// TODO: Create note here

}

0 comments on commit 13ed94f

Please sign in to comment.