2018-02-09 06:29:29 +00:00
|
|
|
function targetIsLocalhost (instanceName) {
|
2018-02-25 05:27:32 +00:00
|
|
|
return instanceName.startsWith('localhost:') || instanceName.startsWith('127.0.0.1:')
|
2018-01-19 05:52:58 +00:00
|
|
|
}
|
|
|
|
|
2018-02-09 06:29:29 +00:00
|
|
|
export function basename (instanceName) {
|
2018-12-09 01:15:01 +00:00
|
|
|
if (targetIsLocalhost(instanceName)) {
|
2018-01-19 05:52:58 +00:00
|
|
|
return `http://${instanceName}`
|
|
|
|
}
|
|
|
|
return `https://${instanceName}`
|
2018-02-09 06:29:29 +00:00
|
|
|
}
|
2018-02-24 22:49:28 +00:00
|
|
|
|
|
|
|
export function auth (accessToken) {
|
|
|
|
return {
|
|
|
|
'Authorization': `Bearer ${accessToken}`
|
|
|
|
}
|
|
|
|
}
|