#Custom Hooks Error: Missing Where Query of Document to update

1 messages · Page 1 of 1 (latest)

primal kraken
#

i don't know what cause this error happened. i just want to update other collection that related to the current collections that fire of this hooks. below are the hooks and collections

primal kraken
#
//collection
import { UserRejectionBlock } from '@/blocks'
import { CollectionConfig } from 'payload'
import { verifyUser } from '../hooks/verifyUser'

export const UserVerificationRequest: CollectionConfig = {
  slug: 'userVerificationRequest',
  admin: {
    group: 'Verification',
    components: {
      edit: {},
    },
  },
  hooks: {
    afterChange: [verifyUser],
  },
  fields: [
    {
      name: 'user',
      type: 'relationship',
      relationTo: 'users',
      required: true,
      admin: {
        readOnly: true,
        components: {
          Field: '@/components/payload/verifications/user-card',
        },
      },
    },
    {
      name: 'approval',
      type: 'select',
      options: [
        {
          label: 'Pending',
          value: 'PENDING',
        },
        {
          label: 'Approved',
          value: 'APPROVED',
        },
        {
          label: 'Rejected',
          value: 'REJECTED',
        },
      ],
      interfaceName: 'RequestApproval',
      required: true,
      defaultValue: 'PENDING',
      label: 'Status',
    },
    {
      name: 'rejection',
      label: 'Alasan Penolakan',
      type: 'blocks',
      blocks: [UserRejectionBlock],
      maxRows: 1,
    },
  ],
}