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

fix: refactor code in preUploadMiddleware function

This commit is contained in:
2022-06-06 17:23:09 +05:00
parent dffe6d7121
commit 6d6bda5626

View File

@@ -33,19 +33,18 @@ export class FileUploadController {
runTime runTime
if (await fileExists(codePath)) { if (await fileExists(codePath)) {
let sessionController
if (runTime === SASJSRunTimes.JS) { if (runTime === SASJSRunTimes.JS) {
const sessionController = getJSSessionController() sessionController = getJSSessionController()
const session = await sessionController.getSession()
req.sasjsSession = session
} else { } else {
const sessionController = getSASSessionController() sessionController = getSASSessionController()
}
const session = await sessionController.getSession() const session = await sessionController.getSession()
// marking consumed true, so that it's not available // marking consumed true, so that it's not available
// as readySession for any other request // as readySession for any other request
session.consumed = true session.consumed = true
req.sasjsSession = session req.sasjsSession = session
} break
} }
} }