From 3b188cd724f3f05144666797c3c8f38244885aae Mon Sep 17 00:00:00 2001 From: Mihajlo Medjedovic Date: Fri, 26 Aug 2022 18:03:28 +0200 Subject: [PATCH] style: lint --- api/src/routes/api/mock-sas9.ts | 54 +++++++++++++++++++++------------ api/src/routes/web/web.ts | 2 +- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/api/src/routes/api/mock-sas9.ts b/api/src/routes/api/mock-sas9.ts index 7799dfc..4281d1b 100644 --- a/api/src/routes/api/mock-sas9.ts +++ b/api/src/routes/api/mock-sas9.ts @@ -14,14 +14,18 @@ mockSas9Router.get('/SASStoredProcess', async (req, res) => { return } - const filePath = path.join(process.cwd(), 'mocks', "generic", "sas9", "sas-stored-process") + const filePath = path.join( + process.cwd(), + 'mocks', + 'generic', + 'sas9', + 'sas-stored-process' + ) let file try { - file = await readFile( - filePath - ) + file = await readFile(filePath) } catch (err: any) { console.error(`Mocked file on path: ${filePath} is not found.`) res.status(403).send(err.toString()) @@ -39,13 +43,11 @@ mockSas9Router.post('/SASStoredProcess/do/', async (req, res) => { let program = req.query._program?.toString() || '' program = program.replace('/', '') const filePath = path.join(process.cwd(), 'mocks', ...program.split('/')) - + let file try { - file = await readFile( - filePath - ) + file = await readFile(filePath) } catch (err: any) { let err = `Mocked file on path: ${filePath} is not found.` console.error(err) @@ -82,12 +84,16 @@ mockSas9Router.post('/SASStoredProcess/do/', async (req, res) => { if (MOCK_SERVERTYPE !== undefined) { mockSas9Router.get('/SASLogon/login', async (req, res) => { - const filePath = path.join(process.cwd(), 'mocks', 'generic', 'sas9', 'login') + const filePath = path.join( + process.cwd(), + 'mocks', + 'generic', + 'sas9', + 'login' + ) try { - const file = await readFile( - filePath - ) + const file = await readFile(filePath) res.send(file) } catch (err: any) { @@ -98,12 +104,16 @@ if (MOCK_SERVERTYPE !== undefined) { mockSas9Router.post('/SASLogon/login', async (req, res) => { loggedIn = true - const filePath = path.join(process.cwd(), 'mocks', 'generic', 'sas9', 'logged-in') + const filePath = path.join( + process.cwd(), + 'mocks', + 'generic', + 'sas9', + 'logged-in' + ) try { - const file = await readFile( - filePath - ) + const file = await readFile(filePath) res.send(file) } catch (err: any) { @@ -114,12 +124,16 @@ if (MOCK_SERVERTYPE !== undefined) { mockSas9Router.get('/SASLogon/logout', async (req, res) => { loggedIn = false - const filePath = path.join(process.cwd(), 'mocks', 'generic', 'sas9', 'logged-out') + const filePath = path.join( + process.cwd(), + 'mocks', + 'generic', + 'sas9', + 'logged-out' + ) try { - const file = await readFile( - filePath - ) + const file = await readFile(filePath) res.send(file) } catch (err: any) { diff --git a/api/src/routes/web/web.ts b/api/src/routes/web/web.ts index 956056d..e53099b 100644 --- a/api/src/routes/web/web.ts +++ b/api/src/routes/web/web.ts @@ -33,7 +33,7 @@ if (MOCK_SERVERTYPE === undefined) { webRouter.post('/SASLogon/login', desktopRestrict, async (req, res) => { const { error, value: body } = loginWebValidation(req.body) if (error) return res.status(400).send(error.details[0].message) - + try { const response = await controller.login(req, body) res.send(response)