1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-17 00:50:05 +00:00

Merge pull request #139 from sasjs/location-issue

fix(location): added handle cases when 'location' is not defined
This commit is contained in:
Krishna Acondy
2020-10-29 08:07:11 +00:00
committed by GitHub

View File

@@ -1365,11 +1365,15 @@ export default class SASjs {
this.sasjsConfig.serverUrl === undefined || this.sasjsConfig.serverUrl === undefined ||
this.sasjsConfig.serverUrl === '' this.sasjsConfig.serverUrl === ''
) { ) {
if (typeof location !== 'undefined') {
let url = `${location.protocol}//${location.hostname}` let url = `${location.protocol}//${location.hostname}`
if (location.port) {
url = `${url}:${location.port}` if (location.port) url = `${url}:${location.port}`
}
this.sasjsConfig.serverUrl = url this.sasjsConfig.serverUrl = url
} else {
this.sasjsConfig.serverUrl = ''
}
} }
if (this.sasjsConfig.serverUrl.slice(-1) === '/') { if (this.sasjsConfig.serverUrl.slice(-1) === '/') {