Skip to content

Commit

Permalink
chore: return res
Browse files Browse the repository at this point in the history
  • Loading branch information
tshuli committed Nov 16, 2020
1 parent 86c5929 commit 653be9a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/app/controllers/frontend.server.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports.datalayer = function (req, res) {
`
try {
const ejsRendered = ejs.render(js, req.app.locals)
res.type('text/javascript').status(StatusCodes.OK).send(ejsRendered)
return res.type('text/javascript').status(StatusCodes.OK).send(ejsRendered)
} catch (err) {
logger.error({
message: 'Error returning datalayer',
Expand All @@ -32,7 +32,7 @@ module.exports.datalayer = function (req, res) {
},
error: err,
})
res.status(StatusCodes.BAD_REQUEST).json({
return res.status(StatusCodes.BAD_REQUEST).json({
message: 'There was an unexpected error. Please refresh and try again.',
})
}
Expand All @@ -44,7 +44,7 @@ module.exports.datalayer = function (req, res) {
*/
module.exports.environment = function (req, res) {
try {
res
return res
.type('text/javascript')
.status(StatusCodes.OK)
.send(req.app.locals.environment)
Expand All @@ -57,7 +57,7 @@ module.exports.environment = function (req, res) {
},
error: err,
})
res.status(StatusCodes.BAD_REQUEST).json({
return res.status(StatusCodes.BAD_REQUEST).json({
message: 'There was an unexpected error. Please refresh and try again.',
})
}
Expand All @@ -81,7 +81,7 @@ module.exports.redirectLayer = function (req, res) {

try {
const ejsRendered = ejs.render(js, req.query).replace(/&/g, '&')
res.type('text/javascript').status(StatusCodes.OK).send(ejsRendered)
return res.type('text/javascript').status(StatusCodes.OK).send(ejsRendered)
} catch (err) {
logger.error({
message: 'Error returning redirectLayer',
Expand All @@ -91,7 +91,7 @@ module.exports.redirectLayer = function (req, res) {
},
error: err,
})
res.status(StatusCodes.BAD_REQUEST).json({
return res.status(StatusCodes.BAD_REQUEST).json({
message: 'There was an unexpected error. Please refresh and try again.',
})
}
Expand Down

0 comments on commit 653be9a

Please sign in to comment.