"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.imageLoadFunction = exports["default"] = void 0;
var _utils = require("@vtx/utils");
var getToken = function getToken() {
  return (0, _utils.getVtxToken)('token');
};
var imageLoadFunction = exports.imageLoadFunction = function imageLoadFunction(image, src) {
  var xhr = new XMLHttpRequest();
  xhr.responseType = 'blob';
  xhr.open('GET', src);
  xhr.setRequestHeader('Authorization', "Bearer ".concat(getToken()));
  xhr.onload = function () {
    var url = URL.createObjectURL(xhr.response);
    var img = image.getImage();
    img.addEventListener('load', function () {
      URL.revokeObjectURL(url);
    });
    img.src = url;
  };
  xhr.send();
};
var _default = exports["default"] = getToken;
//# sourceMappingURL=getToken.js.map
