Skip to content

Commit

Permalink
fix: revalidation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierniki committed Sep 11, 2023
1 parent 15c7912 commit ff8ad42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/app/api/algolia-webhook/publish/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ async function handleAlgoliaPublishWebhook(req: NextRequestWithValidBody<z.infer
slug,
})

revalidatePath(`/[lang]/article/[slug]`)
return { title, locale }
})
)

revalidatePath(`/[lang]/article/[slug]`)

return NextResponse.json({ result: indexingResults }, { status: 201 })
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/api/algolia-webhook/unpublish/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ async function handleAlgoliaUnpublishWebhook(req: NextRequestWithValidBody<z.inf
const index = algoliaClient.initIndex(`articles-${locale}`)
await index.deleteObject(article.id)

revalidatePath(`/[lang]/article/[slug]`)

return { locale }
})
)

revalidatePath(`/[lang]/article/[slug]`)

return NextResponse.json({ result: indexingResults }, { status: 201 })
}

Expand Down

0 comments on commit ff8ad42

Please sign in to comment.