cache browser

deepsource-autofix-76c6eb20
Dan Gowans 2022-10-12 15:59:45 -04:00
parent cf5ac7cba9
commit 1ec9c9d20a
1 changed files with 8 additions and 4 deletions

View File

@ -19,9 +19,7 @@ export const handler = async (request, response, next) => {
response.setHeader("Content-Type", "application/pdf"); response.setHeader("Content-Type", "application/pdf");
response.send(pdf); response.send(pdf);
}; };
reportData.configFunctions = configFunctions; const ejsCallbackFunction = async (ejsError, ejsData) => {
reportData.dateTimeFunctions = dateTimeFunctions;
await ejs.renderFile(reportPath, reportData, {}, async (ejsError, ejsData) => {
if (ejsError) { if (ejsError) {
return next(ejsError); return next(ejsError);
} }
@ -29,8 +27,14 @@ export const handler = async (request, response, next) => {
format: "letter", format: "letter",
printBackground: true, printBackground: true,
preferCSSPageSize: true preferCSSPageSize: true
}, undefined, {
cacheBrowser: true,
remoteContent: false
}); });
return; return;
}); };
reportData.configFunctions = configFunctions;
reportData.dateTimeFunctions = dateTimeFunctions;
await ejs.renderFile(reportPath, reportData, {}, ejsCallbackFunction);
}; };
export default handler; export default handler;