Skip to content

Commit

Permalink
move a conditional to the handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash committed Jul 17, 2024
1 parent 91f5a85 commit ff8be5a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 2 additions & 4 deletions server/routes/alerts-and-warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,8 @@ module.exports = [{
method: 'GET',
path: `/${route}`,
handler: (request, h) => {
if (request.query.q) {
if (isLocationEngland(util.cleanseLocation(request.query.q))) {
return h.redirect(`/${route}`)
}
if (request.query.q && isLocationEngland(util.cleanseLocation(request.query.q))) {
return h.redirect(`/${route}`)
}

return routeHandler(request, h)
Expand Down
4 changes: 0 additions & 4 deletions server/routes/river-and-sea-levels.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ async function locationQueryHandler (request, h) {
return h.view(route, { model: emptyResultsModel() })
}

if (isLocationEngland(location)) {
return h.redirect(`/${route}`)
}

const rivers = await request.server.methods.flood.getRiversByName(location)
let places = await findPlaces(location)

Expand Down

0 comments on commit ff8be5a

Please sign in to comment.