mirror of
https://github.com/ThisIsBenny/wishlist-app.git
synced 2025-04-19 23:37:41 +00:00
regex for url slug text added
Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
parent
9f63089261
commit
43f389c29b
5 changed files with 24 additions and 19 deletions
|
@ -84,9 +84,9 @@ const schema = object().shape(
|
||||||
300,
|
300,
|
||||||
t('components.form-wishlist.description.error-max')
|
t('components.form-wishlist.description.error-max')
|
||||||
),
|
),
|
||||||
slugUrlText: string().required(
|
slugUrlText: string()
|
||||||
t('components.form-wishlist.slug-text.error-requried')
|
.required(t('components.form-wishlist.slug-text.error-requried'))
|
||||||
),
|
.matches(/^[\w-]+$/, t('components.form-wishlist.slug-text.error-regex')),
|
||||||
imageSrc: string().when('imageFile', {
|
imageSrc: string().when('imageFile', {
|
||||||
is: (imageFile: string) => !imageFile || imageFile.length === 0,
|
is: (imageFile: string) => !imageFile || imageFile.length === 0,
|
||||||
then: string().required(
|
then: string().required(
|
||||||
|
|
|
@ -51,11 +51,12 @@ const props = defineProps({
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
const { value: inputValue, errorMessage, handleBlur, handleChange } = useField(
|
const {
|
||||||
props.name,
|
value: inputValue,
|
||||||
undefined,
|
errorMessage,
|
||||||
{
|
handleBlur,
|
||||||
|
handleChange,
|
||||||
|
} = useField(props.name, undefined, {
|
||||||
initialValue: props.value,
|
initialValue: props.value,
|
||||||
}
|
})
|
||||||
)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -55,11 +55,12 @@ const props = defineProps({
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
const { value: inputValue, errorMessage, handleBlur, handleChange } = useField(
|
const {
|
||||||
props.name,
|
value: inputValue,
|
||||||
undefined,
|
errorMessage,
|
||||||
{
|
handleBlur,
|
||||||
|
handleChange,
|
||||||
|
} = useField(props.name, undefined, {
|
||||||
initialValue: props.value,
|
initialValue: props.value,
|
||||||
}
|
})
|
||||||
)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -136,7 +136,8 @@
|
||||||
},
|
},
|
||||||
"slug-text": {
|
"slug-text": {
|
||||||
"label": "URL Slug-Text",
|
"label": "URL Slug-Text",
|
||||||
"error-requried": "URL Slug-Text wird benötigt."
|
"error-requried": "URL Slug-Text wird benötigt.",
|
||||||
|
"error-regex": "Unngültige URL Slug-Text."
|
||||||
},
|
},
|
||||||
"image-src": {
|
"image-src": {
|
||||||
"label": "Bild-URL",
|
"label": "Bild-URL",
|
||||||
|
|
|
@ -135,7 +135,9 @@
|
||||||
"error-max": "The max. length is 300 chars."
|
"error-max": "The max. length is 300 chars."
|
||||||
},
|
},
|
||||||
"slug-text": {
|
"slug-text": {
|
||||||
"label": "URL Slug-Text"
|
"label": "URL Slug-Text",
|
||||||
|
"error-requried": "URL Slug-Text is required.",
|
||||||
|
"error-regex": "Invalid URL Slug-Text."
|
||||||
},
|
},
|
||||||
"image-src": {
|
"image-src": {
|
||||||
"label": "Image-URL",
|
"label": "Image-URL",
|
||||||
|
|
Loading…
Add table
Reference in a new issue