Update carrack.js so it can put Authentication

This commit is contained in:
Dita Aji Pratama 2025-03-10 14:33:58 +07:00
parent 7f77ad39bf
commit ef0e47d7f5

View File

@ -1,7 +1,8 @@
function sendHttpRequest(url, method, data, callback, contentType = "multipart/form-data") { function sendHttpRequest(url, method, data, callback, contentType = "multipart/form-data", authorization = "") {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open(method, url, true); xhr.open(method, url, true);
xhr.setRequestHeader("Content-Type", contentType); xhr.setRequestHeader("Content-Type", contentType);
xhr.setRequestHeader("Authorization", authorization);
xhr.onreadystatechange = function () { xhr.onreadystatechange = function () {
if (xhr.readyState === 4) { if (xhr.readyState === 4) {
if (xhr.status === 200) { if (xhr.status === 200) {