fix hashtags validation
This commit is contained in:
parent
02166f9b86
commit
4aa79dc376
@ -94,7 +94,7 @@
|
|||||||
|
|
||||||
const hashtagsValue = writable($hashtags)
|
const hashtagsValue = writable($hashtags)
|
||||||
const hashtagsState = derived([hashtagsValue], ([$hashtagsValue]) => {
|
const hashtagsState = derived([hashtagsValue], ([$hashtagsValue]) => {
|
||||||
if ($hashtagsValue.some(hashtag => !/[a-z0-9]+/i.test(hashtag))) {
|
if ($hashtagsValue.some(hashtag => !/^[a-z0-9]+$/i.test(hashtag))) {
|
||||||
return { valid: false, error: 'Hashtags can only contains alphanumeric characters.' }
|
return { valid: false, error: 'Hashtags can only contains alphanumeric characters.' }
|
||||||
} else if ($hashtagsValue.length === 0) {
|
} else if ($hashtagsValue.length === 0) {
|
||||||
return { valid: false, error: 'At least one hashtag is required.' }
|
return { valid: false, error: 'At least one hashtag is required.' }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user