Make baseName check if http is already in the name
This commit is contained in:
parent
10d3f3f0a0
commit
2662210063
1 changed files with 7 additions and 2 deletions
|
@ -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}`
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue