From 0397fc21cb462775af898a031da92c2b893ca42d Mon Sep 17 00:00:00 2001 From: hellekin Date: Fri, 9 Mar 2018 14:59:47 +0100 Subject: Make deployment transparent to the app -- JavaScript... --- assets/mapper.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/assets/mapper.js b/assets/mapper.js index e4451a5..083405b 100644 --- a/assets/mapper.js +++ b/assets/mapper.js @@ -146,12 +146,13 @@ Categories.forEach(function(c) { }) // Where do we get our JSON data from -if (location.href.includes('localhost')) { - const api_base = 'http://localhost/data/' -} else { - const api_base = 'https://map.incommon.cc/data/' - //const api_base = 'http://maps.dewey.be/api' +function apiBaseUrl() { + if (location.href.includes('localhost')) { + return 'http://localhost/data/' + } + return 'https://map.incommon.cc/data/' } +const api_base = apiBaseUrl() const cat_uri = api_base + '/categories.json' /** -- cgit v1.2.3