Loading src/api/test-drive-page/content-types/test-drive-page/lifecycles.ts 0 → 100644 +32 −0 Original line number Diff line number Diff line // TODO: remove hardcode, replicate, settings for different brands import { CACHE_TAGS } from "../../../../lib/constants/cache-tags"; export default { afterCreate(event) { if (event?.result.publishedAt) { fetch("http://localhost:3000/api/revalidate-tag", { method: "POST", body: JSON.stringify({ tags: [CACHE_TAGS.testDrivePage] }), }); } }, afterDelete(event) { if (event?.result.publishedAt) { fetch("http://localhost:3000/api/revalidate-tag", { method: "POST", body: JSON.stringify({ tags: [CACHE_TAGS.testDrivePage] }), }); } }, afterUpdate(event) { if (event?.result.publishedAt) { fetch("http://localhost:3000/api/revalidate-tag", { method: "POST", body: JSON.stringify({ tags: [CACHE_TAGS.testDrivePage] }), }); } }, }; src/lib/constants/cache-tags.ts 0 → 100644 +5 −0 Original line number Diff line number Diff line export const CACHE_TAGS = { testDrivePage: "test-drive-page", corporateSalesPage: "corporate-sales-page", insurancePage: "insurance-page", } as const; Loading
src/api/test-drive-page/content-types/test-drive-page/lifecycles.ts 0 → 100644 +32 −0 Original line number Diff line number Diff line // TODO: remove hardcode, replicate, settings for different brands import { CACHE_TAGS } from "../../../../lib/constants/cache-tags"; export default { afterCreate(event) { if (event?.result.publishedAt) { fetch("http://localhost:3000/api/revalidate-tag", { method: "POST", body: JSON.stringify({ tags: [CACHE_TAGS.testDrivePage] }), }); } }, afterDelete(event) { if (event?.result.publishedAt) { fetch("http://localhost:3000/api/revalidate-tag", { method: "POST", body: JSON.stringify({ tags: [CACHE_TAGS.testDrivePage] }), }); } }, afterUpdate(event) { if (event?.result.publishedAt) { fetch("http://localhost:3000/api/revalidate-tag", { method: "POST", body: JSON.stringify({ tags: [CACHE_TAGS.testDrivePage] }), }); } }, };
src/lib/constants/cache-tags.ts 0 → 100644 +5 −0 Original line number Diff line number Diff line export const CACHE_TAGS = { testDrivePage: "test-drive-page", corporateSalesPage: "corporate-sales-page", insurancePage: "insurance-page", } as const;