Skip to content

Commit

Permalink
fix failing feedback field in example/hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
dcousens committed Sep 20, 2023
1 parent 4889838 commit e26a754
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/hooks/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ export const lists: Lists = {
validateInput: ({ context, operation, inputData, addValidationError }) => {
const { title, content } = inputData;

if (operation === 'update') {
if (operation === 'update' && 'feedback' in inputData) {
const { feedback } = inputData;
if (/profanity/i.test(feedback)) return addValidationError('Unacceptable feedback');
if (/profanity/i.test(feedback ?? '')) return addValidationError('Unacceptable feedback');
}

// an example of a content filter, the prevents the title or content containing the word "Profanity"
Expand Down

0 comments on commit e26a754

Please sign in to comment.