1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-05 05:40:06 +00:00

chore: added check session + code refactor

This commit is contained in:
Saad Jutt
2021-12-05 08:17:54 +05:00
parent a80e5c8ead
commit 43545fa04b
14 changed files with 123 additions and 50 deletions

View File

@@ -0,0 +1,18 @@
export const desktopRestrict = (req: any, res: any, next: any) => {
const { MODE } = process.env
if (MODE?.trim() !== 'server')
return res.status(403).send('Not Allowed while in Desktop Mode.')
next()
}
export const desktopUsername = (req: any, res: any, next: any) => {
const { MODE } = process.env
if (MODE?.trim() !== 'server')
return res.status(200).send({
userId: 12345,
username: 'DESKTOPusername',
displayName: 'DESKTOP User'
})
next()
}