1
0
mirror of https://github.com/nolanlawson/pinafore synced 2025-02-02 06:47:19 +01:00

16 lines
544 B
JavaScript
Raw Normal View History

const isLocalhost = process.browser && process.env.NODE_ENV !== 'production' &&
(document.location.hostname === 'localhost' ||
document.location.hostname === '127.0.0.1')
2018-02-08 22:29:29 -08:00
function targetIsLocalhost (instanceName) {
return process.browser && process.env.NODE_ENV !== 'production' &&
(instanceName === 'localhost:3000' || instanceName === '127.0.0.1:3000')
}
2018-02-08 22:29:29 -08:00
export function basename (instanceName) {
if (isLocalhost && targetIsLocalhost(instanceName)) {
return `http://${instanceName}`
}
return `https://${instanceName}`
2018-02-08 22:29:29 -08:00
}