feat(cms): add revalidateAfterChange hooks to Locations, Tariffs, Reviews, BirthdayPackages
This commit is contained in:
parent
2c59ea9ab7
commit
480b10feed
4 changed files with 8 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue