Skip to content

Commit

Permalink
feat: handle translations update in webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierniki committed Nov 9, 2023
1 parent 7d2c955 commit 225f2c6
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/app/api/webhook/handleRevalidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,22 @@ const modelTypeToTags: Record<RevalidationBody["data"]["__typename"], Tag[]> = {
Homepage: ["HOMEPAGE"],
Category: ["CATEGORY"],
Author: ["ARTICLE"],
Singleton: ["TRANSLATIONS"],
GlobalTranslations: ["TRANSLATIONS"],
}

export const modelTypesSchema = z.object({
__typename: z.enum(["Article", "Navigation", "Footer", "Page", "Homepage", "Category", "Author"]),
__typename: z.enum([
"Article",
"Navigation",
"Footer",
"Page",
"Homepage",
"Category",
"Author",
"Singleton",
"GlobalTranslations",
]),
})

const isArticle = (data: RevalidationBody["data"]): data is z.infer<typeof articleSchema> =>
Expand Down

0 comments on commit 225f2c6

Please sign in to comment.