From 9f66d1322d3e709cb42a87bba01787d894f284cd Mon Sep 17 00:00:00 2001 From: Robert Strouse Date: Sun, 19 Dec 2021 08:17:59 -0800 Subject: [PATCH] Updated fileApiService to include proxy redirection and relative paths #45 --- scripts/widgets.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/widgets.js b/scripts/widgets.js index ff2a202..ef6bfc5 100644 --- a/scripts/widgets.js +++ b/scripts/widgets.js @@ -512,8 +512,10 @@ jQuery.each(['get', 'put', 'delete', 'post'], function (i, method) { } }; var cbShowSuccess = function (data, status, jqXHR) { }; - var serviceUrl = $('body').attr('data-apiserviceurl') + (!url.startsWith('/') ? '/' : '') + url; - + var useProxy = makeBool($('body').attr('data-apiproxy')); + var serviceUrl = useProxy ? '/njsPC' + (!url.startsWith('/') ? '/' : '') + url : $('body').attr('data-apiserviceurl') + (!url.startsWith('/') ? '/' : '') + url; + if (serviceUrl.startsWith('/')) serviceUrl = serviceUrl.substring(1); + console.log({ serviceUrl: serviceUrl, useProxy: useProxy }); // Set up the callbacks. successCallback = $.mergeCallbacks(successCallback, cbShowSuccess);