refactor checkValidUrl method

This commit is contained in:
Jay Makwana
2020-05-28 21:02:11 +05:30
parent 3e4decdfb9
commit ffa5b6b2ad

View File

@ -128,6 +128,14 @@ export default {
},
checkValidUrl(url) {
if (
url.includes('http://localhost') ||
url.includes('http://127.0.0.1') ||
url.includes('https://localhost') ||
url.includes('https://127.0.0.1')
) {
return true
}
let pattern = new RegExp(
'^(https?:\\/\\/)?' + // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name