validate real estate type selection
This commit is contained in:
@@ -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";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user