Skip to content

Commit

Permalink
dependencies
Browse files Browse the repository at this point in the history
- fix pdf output
- fix eslint imports
  • Loading branch information
dangowans committed Oct 28, 2024
1 parent 055f708 commit 4b8b483
Show file tree
Hide file tree
Showing 7 changed files with 7,501 additions and 1,540 deletions.
3 changes: 1 addition & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { configWebApp } from 'eslint-config-cityssm';
import tseslint from 'typescript-eslint';
import { configWebApp, tseslint } from 'eslint-config-cityssm';
export const config = tseslint.config(...configWebApp, {
languageOptions: {
parserOptions: {
Expand Down
3 changes: 1 addition & 2 deletions eslint.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { configWebApp } from 'eslint-config-cityssm'
import tseslint from 'typescript-eslint'
import { configWebApp, tseslint } from 'eslint-config-cityssm'

export const config = tseslint.config(...configWebApp, {
languageOptions: {
Expand Down
1 change: 0 additions & 1 deletion handlers/print-get/pdf.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/// <reference types="cookie-parser" />
import type { NextFunction, Request, Response } from 'express';
export declare function handler(request: Request, response: Response, next: NextFunction): Promise<void>;
export default handler;
5 changes: 3 additions & 2 deletions handlers/print-get/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export async function handler(request, response, next) {
response.send(pdf);
}
async function ejsCallbackFunction(ejsError, ejsData) {
if (ejsError) {
// eslint-disable-next-line unicorn/no-null
if (ejsError != null) {
next(ejsError);
return;
}
Expand All @@ -34,7 +35,7 @@ export async function handler(request, response, next) {
printBackground: true,
preferCSSPageSize: true
});
pdfCallbackFunction(pdf);
pdfCallbackFunction(Buffer.from(pdf));
}
await renderEjsFile(reportPath, reportData, {}, ejsCallbackFunction);
}
Expand Down
7 changes: 4 additions & 3 deletions handlers/print-get/pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ export async function handler(
}

async function ejsCallbackFunction(
ejsError: Error,
ejsError: Error | null,
ejsData: string
): Promise<void> {
if (ejsError) {
// eslint-disable-next-line unicorn/no-null
if (ejsError != null) {
next(ejsError)
return
}
Expand All @@ -77,7 +78,7 @@ export async function handler(
preferCSSPageSize: true
})

pdfCallbackFunction(pdf)
pdfCallbackFunction(Buffer.from(pdf))
}

await renderEjsFile(reportPath, reportData, {}, ejsCallbackFunction)
Expand Down
Loading

0 comments on commit 4b8b483

Please sign in to comment.