From a07eabc40809bf86ff9a885516e16ee7012228c9 Mon Sep 17 00:00:00 2001 From: Yury Shkoda Date: Thu, 29 Oct 2020 10:07:30 +0300 Subject: [PATCH] fix(location): added handle cases when 'location' is not defined --- src/SASjs.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/SASjs.ts b/src/SASjs.ts index 39e4505..c12eb42 100644 --- a/src/SASjs.ts +++ b/src/SASjs.ts @@ -1365,11 +1365,15 @@ export default class SASjs { this.sasjsConfig.serverUrl === undefined || this.sasjsConfig.serverUrl === '' ) { - let url = `${location.protocol}//${location.hostname}` - if (location.port) { - url = `${url}:${location.port}` + if (typeof location !== 'undefined') { + let url = `${location.protocol}//${location.hostname}` + + if (location.port) url = `${url}:${location.port}` + + this.sasjsConfig.serverUrl = url + } else { + this.sasjsConfig.serverUrl = '' } - this.sasjsConfig.serverUrl = url } if (this.sasjsConfig.serverUrl.slice(-1) === '/') {