From 1d0413ad302725a695ddd6a9c7821a278d127cec Mon Sep 17 00:00:00 2001
From: Glenn Vorhes <gavorhes@wisc.edu>
Date: Thu, 21 Jun 2018 13:53:52 -0500
Subject: [PATCH] only local api for port 8081

---
 dist/api/host.js                | 3 +++
 dist/api/host.js.map            | 2 +-
 src/api/host.ts                 | 5 +++++
 test/serve/html/simple_map.html | 2 +-
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/dist/api/host.js b/dist/api/host.js
index 88fb722..591eaaa 100644
--- a/dist/api/host.js
+++ b/dist/api/host.js
@@ -1,6 +1,9 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
 var isLocal = window.location.href.indexOf('localhost') > -1;
+if (parseInt(window.location.port) !== 8081) {
+    isLocal = false;
+}
 var stage_prod = window.location.pathname.indexOf('webmapsstage') > -1 ? 'webmapsstage' : 'webmaps';
 exports.hostRoot = isLocal ? 'http://localhost:8081' : "https://transportal.cee.wisc.edu/gis/" + stage_prod;
 exports.apiRoot = exports.hostRoot + "/api";
diff --git a/dist/api/host.js.map b/dist/api/host.js.map
index afff248..629a85a 100644
--- a/dist/api/host.js.map
+++ b/dist/api/host.js.map
@@ -1 +1 @@
-{"version":3,"file":"host.js","sourceRoot":"","sources":["../../src/api/host.ts"],"names":[],"mappings":";;AAAA,IAAI,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;AAE7D,IAAI,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,cAAc,GAAG,SAAS,CAAC;AAEvF,QAAA,QAAQ,GAAG,OAAO,GAAG,uBAAuB,GAAG,0CAAwC,UAAY,CAAC;AAEpG,QAAA,OAAO,GAAG,gBAAQ,GAAG,MAAM,CAAC","sourcesContent":["let isLocal = window.location.href.indexOf('localhost') > -1;\r\n\r\nlet stage_prod = window.location.pathname.indexOf('webmapsstage') > -1 ? 'webmapsstage' : 'webmaps';\r\n\r\nexport const hostRoot = isLocal ? 'http://localhost:8081' : `https://transportal.cee.wisc.edu/gis/${stage_prod}`;\r\n\r\nexport const apiRoot = hostRoot + `/api`;\r\n\r\n"]}
\ No newline at end of file
+{"version":3,"file":"host.js","sourceRoot":"","sources":["../../src/api/host.ts"],"names":[],"mappings":";;AAAA,IAAI,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;AAE7D,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAA,CAAC;IACzC,OAAO,GAAG,KAAK,CAAC;AACpB,CAAC;AAGD,IAAI,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,cAAc,GAAG,SAAS,CAAC;AAEvF,QAAA,QAAQ,GAAG,OAAO,GAAG,uBAAuB,GAAG,0CAAwC,UAAY,CAAC;AAEpG,QAAA,OAAO,GAAG,gBAAQ,GAAG,MAAM,CAAC","sourcesContent":["let isLocal = window.location.href.indexOf('localhost') > -1;\r\n\r\nif (parseInt(window.location.port) !== 8081){\r\n    isLocal = false;\r\n}\r\n\r\n\r\nlet stage_prod = window.location.pathname.indexOf('webmapsstage') > -1 ? 'webmapsstage' : 'webmaps';\r\n\r\nexport const hostRoot = isLocal ? 'http://localhost:8081' : `https://transportal.cee.wisc.edu/gis/${stage_prod}`;\r\n\r\nexport const apiRoot = hostRoot + `/api`;\r\n\r\n"]}
\ No newline at end of file
diff --git a/src/api/host.ts b/src/api/host.ts
index f6fe209..6b8a528 100644
--- a/src/api/host.ts
+++ b/src/api/host.ts
@@ -1,5 +1,10 @@
 let isLocal = window.location.href.indexOf('localhost') > -1;
 
+if (parseInt(window.location.port) !== 8081){
+    isLocal = false;
+}
+
+
 let stage_prod = window.location.pathname.indexOf('webmapsstage') > -1 ? 'webmapsstage' : 'webmaps';
 
 export const hostRoot = isLocal ? 'http://localhost:8081' : `https://transportal.cee.wisc.edu/gis/${stage_prod}`;
diff --git a/test/serve/html/simple_map.html b/test/serve/html/simple_map.html
index d383e21..49e2fb0 100644
--- a/test/serve/html/simple_map.html
+++ b/test/serve/html/simple_map.html
@@ -14,7 +14,7 @@
     </div>
     <div id="map"></div>
 </div>
-<script src="../lib/jquery.min.js"></script>
+<script src="../lib/jquery.js"></script>
 <script src="../lib/ol.js"></script>
 <script src="../js/simple_map.js"></script>
 
-- 
GitLab