#Custom Hooks Error: Missing Where Query of Document to update
1 messages · Page 1 of 1 (latest)
Help is on the way! To mark it as solved, use the /solve command. In the meantime, here are some existing threads that may help you:
Documentation:
- React Hooks - useListQuery
- Hooks Overview - Root Hooks - afterError
- Collection Hooks - Config Options - afterError
Community-Help:
//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,
},
],
}