feat(cms): add revalidateAfterChange hooks to Locations, Tariffs, Reviews, BirthdayPackages
Some checks are pending
CI / Type Check (push) Waiting to run
CI / Lint (push) Waiting to run
CI / Unit Tests (push) Waiting to run
Deploy / Build & Push Image (push) Waiting to run
Deploy / Deploy to VPS (push) Blocked by required conditions

This commit is contained in:
Vadym Samoilenko 2026-06-03 13:02:28 +01:00
parent 2c59ea9ab7
commit 480b10feed
4 changed files with 8 additions and 0 deletions

View file

@ -1,8 +1,10 @@
import type { CollectionConfig } from 'payload'
import { isAdminOrEditor } from '@/access/isAdminOrEditor'
import { revalidateAfterChange } from '@/hooks/revalidatePath'
export const BirthdayPackages: CollectionConfig = {
slug: 'birthday-packages',
hooks: { afterChange: [revalidateAfterChange] },
access: {
read: () => true,
create: isAdminOrEditor,

View file

@ -1,8 +1,10 @@
import type { CollectionConfig } from 'payload'
import { isAdminOrEditor } from '@/access/isAdminOrEditor'
import { revalidateAfterChange } from '@/hooks/revalidatePath'
export const Locations: CollectionConfig = {
slug: 'locations',
hooks: { afterChange: [revalidateAfterChange] },
access: {
read: () => true,
create: isAdminOrEditor,

View file

@ -1,8 +1,10 @@
import type { CollectionConfig } from 'payload'
import { isAdminOrEditor } from '@/access/isAdminOrEditor'
import { revalidateAfterChange } from '@/hooks/revalidatePath'
export const Reviews: CollectionConfig = {
slug: 'reviews',
hooks: { afterChange: [revalidateAfterChange] },
access: {
read: () => true,
create: isAdminOrEditor,

View file

@ -1,6 +1,7 @@
import type { CollectionConfig, FieldAccess } from 'payload'
import { lexicalEditor } from '@payloadcms/richtext-lexical'
import { isAdmin } from '@/access/isAdmin'
import { revalidateAfterChange } from '@/hooks/revalidatePath'
const adminFieldAccess: FieldAccess = ({ req: { user } }) => user?.role === 'admin'
@ -20,6 +21,7 @@ export const Tariffs: CollectionConfig = {
description:
'Керування квитками: показ/приховування, значки, описи, фото. Зніміть «Показувати на сайті», щоб приховати квиток (напр. якщо його ще немає в ezy).',
},
hooks: { afterChange: [revalidateAfterChange] },
access: {
read: () => true,
create: isAdmin,