const db = require('../models/index'); const realEstateTypes = [ { ime: "Kuća", id: "kuca" }, { ime: "Stan", id: "stan" }, { ime: "Vikendica", id: "vikendica" } ]; const getRealEstateTypes = (req,res) => { const nextStep = req.query.nextStep; res.render('realEstateType', { nextStep, realEstateTypes: realEstateTypes }); }; const postRealEstateTypes = (req, res) => { let nextStep = req.query.nextStep; db.RealEstateRequest.create({ realEstateType: req.body.realestatetype }).then( (result) => { nextStep = nextStep || `/grad/${result.uniqueId}`; res.redirect(nextStep); }).catch( (e) => { res.send(e); }); }; module.exports = { getRealEstateTypes, postRealEstateTypes };