fix(ui): Add additional URL & email input validation (#843)

This commit is contained in:
TheCatLady
2021-02-04 20:12:51 -05:00
committed by GitHub
parent b9d14a9fd0
commit 3f9bfeb01a
9 changed files with 92 additions and 25 deletions

View File

@@ -15,7 +15,6 @@ const messages = defineMessages({
saving: 'Saving…',
agentenabled: 'Enable Agent',
webhookUrl: 'Webhook URL',
validationWebhookUrlRequired: 'You must provide a webhook URL',
webhookUrlPlaceholder: 'Webhook URL',
slacksettingssaved: 'Slack notification settings saved!',
slacksettingsfailed: 'Slack notification settings failed to save.',
@@ -25,6 +24,7 @@ const messages = defineMessages({
settingupslackDescription:
'To use Slack notifications, you will need to create an <WebhookLink>Incoming Webhook</WebhookLink> integration and use the provided webhook URL below.',
notificationtypes: 'Notification Types',
validationWebhookUrl: 'You must provide a valid URL',
});
const NotificationsSlack: React.FC = () => {
@@ -35,9 +35,9 @@ const NotificationsSlack: React.FC = () => {
);
const NotificationsSlackSchema = Yup.object().shape({
webhookUrl: Yup.string().required(
intl.formatMessage(messages.validationWebhookUrlRequired)
),
webhookUrl: Yup.string()
.required(intl.formatMessage(messages.validationWebhookUrl))
.url(intl.formatMessage(messages.validationWebhookUrl)),
});
if (!data && !error) {