Skip to content

Commit

Permalink
Reparer bug quand l'URL est mal fait
Browse files Browse the repository at this point in the history
  • Loading branch information
hfroot committed Sep 29, 2023
1 parent 5541586 commit 697f921
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions front/handlers/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,15 @@ async function getLocationDetail (req, res) {
if (commune) return { commune }
} else if (req.query.communes || req.query.epcis) {
const location = { communes: [], epcis: [] }
if (req.query.communes) location.communes = req.query.communes.map((c) => getCommune(c, true))
if (req.query.epcis) location.epcis = req.query.epcis.map((c) => getEpci(c, true))
return location
if (req.query.communes && Array.isArray(req.query.communes)) {
location.communes = req.query.communes.map((c) => getCommune(c, true))
}
if (req.query.epcis && Array.isArray(req.query.epcis)) {
location.epcis = req.query.epcis.map((c) => getEpci(c, true))
}
if (location.communes.length || location.epcis.length) {
return location
}
}
}

Expand Down

0 comments on commit 697f921

Please sign in to comment.