Skip to content

Commit

Permalink
[IMP] Added more methods in requests lib
Browse files Browse the repository at this point in the history
  • Loading branch information
c8y3 committed Oct 16, 2024
1 parent c1d4cd7 commit 728398e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ui/src/lib/utils/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

let current_cid = null;

function get_caseid() {
if (current_cid === null) {
let queryString = window.location.search;
let urlParams = new URLSearchParams(queryString);

current_cid = urlParams.get('cid')
}
return current_cid
}

function case_param() {
var params = {
cid: get_caseid
}
return '?'+ $.param(params);
}

function post_request_api(uri, data, propagate_api_error, beforeSend_fn, cid, onError_fn) {
if (cid === undefined ) {
cid = case_param();
Expand Down Expand Up @@ -61,5 +80,7 @@ function post_request_api(uri, data, propagate_api_error, beforeSend_fn, cid, on
}

export {
case_param,
get_caseid,
post_request_api
};

0 comments on commit 728398e

Please sign in to comment.