【update】pdf.js 请求增加token

This commit is contained in:
fengchenchen
2024-07-16 18:19:55 +08:00
parent 1a983885a7
commit 41a33a8025
+11 -6
View File
@@ -938,7 +938,12 @@ function getDocument(src) {
const task = new PDFDocumentLoadingTask();
const url = src.url ? getUrlProp(src.url) : null;
const data = src.data ? getDataProp(src.data) : null;
const httpHeaders = src.httpHeaders || null;
const token = localStorage.getItem('pro__Access-Token')
let tokenValue = token ? JSON.parse(token).value : ''
const header = {
'X-Access-Token': tokenValue
}
const httpHeaders = Object.assign(src.httpHeaders || {}, header);
const withCredentials = src.withCredentials === true;
const password = src.password ?? null;
const rangeTransport = src.range instanceof PDFDataRangeTransport ? src.range : null;
@@ -15493,7 +15498,7 @@ exports.SVGGraphics = SVGGraphics;
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/
/******/ // The require function
/******/ function __w_pdfjs_require__(moduleId) {
/******/ // Check if module is in cache
@@ -15507,14 +15512,14 @@ exports.SVGGraphics = SVGGraphics;
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
/******/
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
@@ -15789,4 +15794,4 @@ const pdfjsBuild = 'af6414988';
/******/ })()
;
});
//# sourceMappingURL=pdf.js.map
//# sourceMappingURL=pdf.js.map