mirror of
https://github.com/sasjs/server.git
synced 2026-01-16 02:10:05 +00:00
style: lint
This commit is contained in:
@@ -14,14 +14,18 @@ mockSas9Router.get('/SASStoredProcess', async (req, res) => {
|
|||||||
return
|
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
|
let file
|
||||||
|
|
||||||
try {
|
try {
|
||||||
file = await readFile(
|
file = await readFile(filePath)
|
||||||
filePath
|
|
||||||
)
|
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
console.error(`Mocked file on path: ${filePath} is not found.`)
|
console.error(`Mocked file on path: ${filePath} is not found.`)
|
||||||
res.status(403).send(err.toString())
|
res.status(403).send(err.toString())
|
||||||
@@ -39,13 +43,11 @@ mockSas9Router.post('/SASStoredProcess/do/', async (req, res) => {
|
|||||||
let program = req.query._program?.toString() || ''
|
let program = req.query._program?.toString() || ''
|
||||||
program = program.replace('/', '')
|
program = program.replace('/', '')
|
||||||
const filePath = path.join(process.cwd(), 'mocks', ...program.split('/'))
|
const filePath = path.join(process.cwd(), 'mocks', ...program.split('/'))
|
||||||
|
|
||||||
let file
|
let file
|
||||||
|
|
||||||
try {
|
try {
|
||||||
file = await readFile(
|
file = await readFile(filePath)
|
||||||
filePath
|
|
||||||
)
|
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
let err = `Mocked file on path: ${filePath} is not found.`
|
let err = `Mocked file on path: ${filePath} is not found.`
|
||||||
console.error(err)
|
console.error(err)
|
||||||
@@ -82,12 +84,16 @@ mockSas9Router.post('/SASStoredProcess/do/', async (req, res) => {
|
|||||||
|
|
||||||
if (MOCK_SERVERTYPE !== undefined) {
|
if (MOCK_SERVERTYPE !== undefined) {
|
||||||
mockSas9Router.get('/SASLogon/login', async (req, res) => {
|
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 {
|
try {
|
||||||
const file = await readFile(
|
const file = await readFile(filePath)
|
||||||
filePath
|
|
||||||
)
|
|
||||||
|
|
||||||
res.send(file)
|
res.send(file)
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
@@ -98,12 +104,16 @@ if (MOCK_SERVERTYPE !== undefined) {
|
|||||||
mockSas9Router.post('/SASLogon/login', async (req, res) => {
|
mockSas9Router.post('/SASLogon/login', async (req, res) => {
|
||||||
loggedIn = true
|
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 {
|
try {
|
||||||
const file = await readFile(
|
const file = await readFile(filePath)
|
||||||
filePath
|
|
||||||
)
|
|
||||||
|
|
||||||
res.send(file)
|
res.send(file)
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
@@ -114,12 +124,16 @@ if (MOCK_SERVERTYPE !== undefined) {
|
|||||||
mockSas9Router.get('/SASLogon/logout', async (req, res) => {
|
mockSas9Router.get('/SASLogon/logout', async (req, res) => {
|
||||||
loggedIn = false
|
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 {
|
try {
|
||||||
const file = await readFile(
|
const file = await readFile(filePath)
|
||||||
filePath
|
|
||||||
)
|
|
||||||
|
|
||||||
res.send(file)
|
res.send(file)
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ if (MOCK_SERVERTYPE === undefined) {
|
|||||||
webRouter.post('/SASLogon/login', desktopRestrict, async (req, res) => {
|
webRouter.post('/SASLogon/login', desktopRestrict, async (req, res) => {
|
||||||
const { error, value: body } = loginWebValidation(req.body)
|
const { error, value: body } = loginWebValidation(req.body)
|
||||||
if (error) return res.status(400).send(error.details[0].message)
|
if (error) return res.status(400).send(error.details[0].message)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await controller.login(req, body)
|
const response = await controller.login(req, body)
|
||||||
res.send(response)
|
res.send(response)
|
||||||
|
|||||||
Reference in New Issue
Block a user