From ffa5b6b2adf57cbdf0022f129a88354f87d73a6d Mon Sep 17 00:00:00 2001 From: Jay Makwana Date: Thu, 28 May 2020 21:02:11 +0530 Subject: [PATCH] refactor checkValidUrl method --- resources/assets/js/helpers/utilities.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/resources/assets/js/helpers/utilities.js b/resources/assets/js/helpers/utilities.js index be9afd51..9bbae1d9 100644 --- a/resources/assets/js/helpers/utilities.js +++ b/resources/assets/js/helpers/utilities.js @@ -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