Add custom error messages for events.

Co-authored-by: maeckes <markus@infinity.labs.ooo>
This commit is contained in:
elweyn 2023-06-07 12:55:21 +02:00
parent 3dadfd4329
commit 4e43b77da2
3 changed files with 30 additions and 1 deletions

View File

@ -286,11 +286,32 @@ export default {
},
},
eventStart: { required: !!this.createEvent },
eventVenue: { required: !!this.createEvent, min: 3, max: 100 },
eventVenue: {
required: !!this.createEvent,
min: 3,
max: 100,
validator: (_, value = '') => {
if (!value.trim()) {
return [new Error(this.$t('common.validations.eventVenueNotEmpty'))]
}
if (value.length < 3 || value.length > 100) {
return [new Error(this.$t('common.validations.eventVenueLength', { min: 3, max: 100 }))]
}
return []
}, },
eventLocationName: {
required: !!this.createEvent && !this.formData.eventIsOnline,
min: 3,
max: 100,
validator: (_, value = '') => {
if (!value.trim()) {
return [new Error(this.$t('common.validations.eventLocationNameNotEmpty'))]
}
if (value.length < 3 || value.length > 100) {
return [new Error(this.$t('common.validations.eventLocationNameLength', { min: 3, max: 100 }))]
}
return []
},
},
}
},

View File

@ -115,6 +115,10 @@
"validations": {
"categories": "es müssen eine bis drei Themen ausgewählt werden",
"email": "muss eine gültige E-Mail-Adresse sein",
"eventLocationNameLength": "Mindestens {min} Maximal {max}",
"eventLocationNameNotEmpty": "es dürfen nicht nur Freizeichen eingetragen werden",
"eventVenueLength": "Mindestens {min} Maximal {max}",
"eventVenueNotEmpty": "es dürfen nicht nur Freizeichen eingetragen werden",
"url": "muss eine gültige URL sein"
},
"versus": "Versus"

View File

@ -115,6 +115,10 @@
"validations": {
"categories": "at least one and at most three topics must be selected",
"email": "must be a valid e-mail address",
"eventLocationNameLength": "minimal {min} maximal {max}",
"eventLocationNameNotEmpty": "only empty characters are not allowed",
"eventVenueLength": "minimal {min} maximal {max}",
"eventVenueNotEmpty": "only empty characters are not allowed",
"url": "must be a valid URL"
},
"versus": "Versus"