From 2662210063208482c85c8bff34865db8c88beef7 Mon Sep 17 00:00:00 2001 From: Ekaterina Vaartis Date: Tue, 24 Sep 2019 20:10:50 +0300 Subject: [PATCH] Make baseName check if http is already in the name --- src/api/utils.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/api/utils.js b/src/api/utils.js index 4943f650..1346a204 100644 --- a/src/api/utils.js +++ b/src/api/utils.js @@ -1,5 +1,10 @@ const isLocalhost = (instanceName) => instanceName.startsWith('localhost:') || instanceName.startsWith('127.0.0.1:') -export const baseName = (instanceName) => - isLocalhost(instanceName) ? `http://${instanceName}` : `https://${instanceName}` +export const baseName = (instanceName) => { + if (instanceName.match(/https?:\/\//)) { + return instanceName + } else { + return isLocalhost(instanceName) ? `http://${instanceName}` : `https://${instanceName}` + } +}