Clean up API calls in JS

This commit is contained in:
30hours 2023-12-19 09:37:42 +00:00
parent 2eef96e3d9
commit 396a36bf90
4 changed files with 27 additions and 17 deletions

View file

@ -6,18 +6,20 @@ var range_x = [];
var range_y = [];
// setup API
var urlTimestamp = '';
var urlTimestamp;
var urlDetection;
if (isLocalHost) {
urlTimestamp = '//' + host + ':3000/api/timestamp?timestamp=' + Date.now();
urlTimestamp = '//' + host + ':3000/api/timestamp';
} else {
urlTimestamp = '//' + host + '/api/timestamp?timestamp=' + Date.now();
urlTimestamp = '//' + host + '/api/timestamp';
}
var urlDetection = '';
if (isLocalHost) {
urlDetection = '//' + host + ':3000/stash/detection?timestamp=' + Date.now();
urlDetection = '//' + host + ':3000/stash/detection';
} else {
urlDetection = '//' + host + '/stash/detection?timestamp=' + Date.now();
urlDetection = '//' + host + '/stash/detection';
}
urlTimestamp = urlTimestamp + '?timestamp=' + Date.now();
urlDetection = urlDetection + '?timestamp=' + Date.now();
// setup plotly
var layout = {

View file

@ -6,13 +6,13 @@ var range_x = [];
var range_y = [];
// setup API
var urlTimestamp = '';
var urlTimestamp;
var urlDetection;
if (isLocalHost) {
urlTimestamp = '//' + host + ':3000/api/timestamp?timestamp=';
urlTimestamp = '//' + host + ':3000/api/timestamp';
} else {
urlTimestamp = '//' + host + '/api/timestamp?timestamp=';
urlTimestamp = '//' + host + '/api/timestamp';
}
var urlDetection = '';
if (isLocalHost) {
urlDetection = '//' + host + ':3000/api/detection';
} else {
@ -23,6 +23,9 @@ if (isLocalHost) {
} else {
urlMap = '//' + host + urlMap;
}
urlTimestamp = urlTimestamp + '?timestamp=' + Date.now();
urlDetection = urlDetection + '?timestamp=' + Date.now();
urlMap = urlMap + '?timestamp=' + Date.now();
// setup plotly
var layout = {

View file

@ -6,7 +6,8 @@ var range_x = [];
var range_y = [];
// setup API
var urlTimestamp = '';
var urlTimestamp;
var urlMap;
if (isLocalHost) {
urlTimestamp = '//' + host + ':3000/api/timestamp';
} else {
@ -17,6 +18,8 @@ if (isLocalHost) {
} else {
urlMap = '//' + host + '/stash/iqdata';
}
urlTimestamp = urlTimestamp + '?timestamp=' + Date.now();
urlMap = urlMap + '?timestamp=' + Date.now();
// setup plotly
var layout = {

View file

@ -4,18 +4,20 @@ var host = window.location.hostname;
var isLocalHost = (host === "localhost" || host === "127.0.0.1" || host === "192.168.0.112");
// setup API
var urlTimestamp = '';
var urlTimestamp;
var urlTiming;
if (isLocalHost) {
urlTimestamp = '//' + host + ':3000/api/timestamp?timestamp=' + Date.now();
urlTimestamp = '//' + host + ':3000/api/timestamp';
} else {
urlTimestamp = '//' + host + '/api/timestamp?timestamp=' + Date.now();
urlTimestamp = '//' + host + '/api/timestamp';
}
var urlDetection = '';
if (isLocalHost) {
urlDetection = '//' + host + ':3000/stash/detection?timestamp=' + Date.now();
urlTiming = '//' + host + ':3000/stash/timing';
} else {
urlDetection = '//' + host + '/stash/timing?timestamp=' + Date.now();
urlTiming = '//' + host + '/stash/timing';
}
urlTimestamp = urlTimestamp + '?timestamp=' + Date.now();
urlTiming = urlTiming + '?timestamp=' + Date.now();
// setup plotly
var layout = {