From 06a3f97ee7ead2f2797d216c969f85f2b57c3ddb Mon Sep 17 00:00:00 2001 From: Nareshkumar Rao <629990+naresh97@users.noreply.github.com> Date: Tue, 3 Aug 2021 03:33:44 +0200 Subject: [PATCH] bugfix & cleanup --- .eslintrc.js | 12 ------------ src/db/utils.ts | 2 +- src/routes/CodeRoute.ts | 4 ++-- src/routes/VerifyRoute.ts | 4 +--- 4 files changed, 4 insertions(+), 18 deletions(-) delete mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 9ae7956..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - env: { - node: true, - commonjs: true, - es2021: true, - }, - extends: "eslint:recommended", - parserOptions: { - ecmaVersion: 12, - }, - rules: {}, -}; diff --git a/src/db/utils.ts b/src/db/utils.ts index 6e5f3d3..552463d 100644 --- a/src/db/utils.ts +++ b/src/db/utils.ts @@ -9,7 +9,7 @@ export function addContact( ): void { User.findOne({ where: { telegram: userATelegram } }).then((userA) => { User.findOne({ where: { id: userBRowID } }).then((userB) => { - if (!!userA || !!userB) { + if (!userA || !userB) { done(false, "Could not find user."); return; } diff --git a/src/routes/CodeRoute.ts b/src/routes/CodeRoute.ts index 9f435b4..aee5b49 100644 --- a/src/routes/CodeRoute.ts +++ b/src/routes/CodeRoute.ts @@ -21,7 +21,7 @@ export function CodeRoute(req: Request, res: Response) { function createQRCode( telegram: TelegramID, - callback: (errorMessage: string, url?: string) => void + callback: (errorMessage: string | Error, url?: string) => void ): void { User.findOne({ where: { @@ -38,7 +38,7 @@ function createQRCode( verifyURL, { width: 300, height: 300 } as QRCodeToDataURLOptions, (error, url) => { - callback(error.message, url); + callback(error, url); } ); }); diff --git a/src/routes/VerifyRoute.ts b/src/routes/VerifyRoute.ts index 43295f3..8a3b47b 100644 --- a/src/routes/VerifyRoute.ts +++ b/src/routes/VerifyRoute.ts @@ -45,6 +45,4 @@ function checkVerification( callback(false, "No such verification"); } }); -} - -exports.VerifyRoute = VerifyRoute; +} \ No newline at end of file