validator tweak
This commit is contained in:
parent
fe374c0439
commit
4fb9a4aa59
|
@ -13,6 +13,7 @@ export const name = (validation, { apps, currentApp } = { apps: [] }) => {
|
||||||
"Another app with the same name already exists",
|
"Another app with the same name already exists",
|
||||||
value => {
|
value => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
|
// exit early, above validator will fail
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if (currentApp) {
|
if (currentApp) {
|
||||||
|
@ -57,12 +58,12 @@ export const url = (validation, { apps, currentApp } = { apps: {} }) => {
|
||||||
.some(appUrl => appUrl.toLowerCase() === value.toLowerCase())
|
.some(appUrl => appUrl.toLowerCase() === value.toLowerCase())
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.test("start-with-slash", "Not a valid URL", value => {
|
.test("valid-url", "Not a valid URL", value => {
|
||||||
// url is nullable
|
// url is nullable
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return value.length > 1
|
return value.startsWith("/") && value.length > 1
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue