1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-10 11:24:35 +00:00

style: lint

This commit is contained in:
2022-08-26 18:03:28 +02:00
parent eeba2328c0
commit 3b188cd724
2 changed files with 35 additions and 21 deletions

View File

@@ -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) {

View File

@@ -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)