validate real estate type selection

This commit is contained in:
Bilal Catic
2019-10-28 10:38:31 +01:00
parent c6aeef10e8
commit 43877820cf

View File

@@ -15,8 +15,15 @@ const getRealEstateTypes = (req, res) => {
const postRealEstateTypes = async (req, res) => {
const searchRequest = await currentSearchRequest(req);
//TODO: check if selected real estate type is valid
const validRealEstateTypes = Object.keys(AD_CATEGORY).filter(
category => !!AD_CATEGORY[category].title
);
const selectedRealEstateType = req.body.realEstateType || null;
if (validRealEstateTypes.indexOf(selectedRealEstateType) === -1) {
res.render("notFound", { title: " " });
return;
}
const nextStepPage = req.query.nextStep || "lokacija";