mirror of
https://github.com/strapi/strapi.git
synced 2025-09-15 11:36:17 +00:00
Enable to create/trigger webhooks with no events (#12174)
Co-authored-by: cyril lopez <cyril@strapi.io>
This commit is contained in:
parent
d8acb3df67
commit
ce09d38972
@ -63,7 +63,7 @@ const EventInput = ({ isDraftAndPublish }) => {
|
|||||||
: displayedData.events.default;
|
: displayedData.events.default;
|
||||||
|
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
const { values, errors, handleChange: onChange } = useFormikContext();
|
const { values, handleChange: onChange } = useFormikContext();
|
||||||
|
|
||||||
const inputName = 'events';
|
const inputName = 'events';
|
||||||
const inputValue = values.events;
|
const inputValue = values.events;
|
||||||
@ -100,7 +100,7 @@ const EventInput = ({ isDraftAndPublish }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack size={1}>
|
<Stack size={1}>
|
||||||
<FieldLabel required>
|
<FieldLabel>
|
||||||
{formatMessage({
|
{formatMessage({
|
||||||
id: 'Settings.webhooks.form.events',
|
id: 'Settings.webhooks.form.events',
|
||||||
defaultMessage: 'Events',
|
defaultMessage: 'Events',
|
||||||
@ -154,14 +154,6 @@ const EventInput = ({ isDraftAndPublish }) => {
|
|||||||
})}
|
})}
|
||||||
</tbody>
|
</tbody>
|
||||||
</StyledTable>
|
</StyledTable>
|
||||||
{errors.events && (
|
|
||||||
<Typography variant="pi" textColor="danger600" data-strapi-field-error>
|
|
||||||
{formatMessage({
|
|
||||||
id: 'components.Input.error.validation.required',
|
|
||||||
defaultMessage: 'This value is required',
|
|
||||||
})}
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -29,10 +29,7 @@ const schema = yup.object().shape({
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
events: yup
|
events: yup.array(),
|
||||||
.array()
|
|
||||||
.min(1, translatedErrors.min)
|
|
||||||
.required(translatedErrors.required),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default schema;
|
export default schema;
|
||||||
|
@ -28,16 +28,12 @@ const webhookValidator = yup
|
|||||||
)
|
)
|
||||||
.required();
|
.required();
|
||||||
}),
|
}),
|
||||||
events: yup
|
events: yup.array().of(
|
||||||
.array()
|
|
||||||
.of(
|
|
||||||
yup
|
yup
|
||||||
.string()
|
.string()
|
||||||
.oneOf(_.values(webhookUtils.webhookEvents))
|
.oneOf(_.values(webhookUtils.webhookEvents))
|
||||||
.required()
|
.required()
|
||||||
)
|
),
|
||||||
.min(1)
|
|
||||||
.required(),
|
|
||||||
})
|
})
|
||||||
.noUnknown();
|
.noUnknown();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user